aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-23 00:10:43 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-23 00:10:43 -0400
commit68add612a037349541b65bc1d1a671199dbfa50b (patch)
treeae1bd4325e93dcaecdf52854ab23935d70ca188d /src
parent07f414ea9e1f682e38754f9ba42094339389185c (diff)
added flag to switch interaction styles
Diffstat (limited to 'src')
-rw-r--r--src/client/views/MainOverlayTextBox.tsx2
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx10
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx25
-rw-r--r--src/client/views/nodes/DocumentView.tsx3
4 files changed, 20 insertions, 20 deletions
diff --git a/src/client/views/MainOverlayTextBox.tsx b/src/client/views/MainOverlayTextBox.tsx
index 2b72b09c6..9aaaad084 100644
--- a/src/client/views/MainOverlayTextBox.tsx
+++ b/src/client/views/MainOverlayTextBox.tsx
@@ -71,7 +71,7 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
document.removeEventListener("pointermove", this.textBoxMove);
document.removeEventListener('pointerup', this.textBoxUp);
let dragData = new DragManager.DocumentDragData([this.TextDoc!]);
- const [left, top] = this._textXf.inverse().transformPoint(0, 0);
+ const [left, top] = this._textXf().inverse().transformPoint(0, 0);
dragData.xOffset = e.clientX - left;
dragData.yOffset = e.clientY - top;
DragManager.StartDocumentDrag([this._textTargetDiv!], dragData, e.clientX, e.clientY, {
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index da5c13312..879bf5bb5 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -24,6 +24,7 @@ import { BooleanField } from "../../../../fields/BooleanField";
@observer
export class CollectionFreeFormView extends CollectionSubView {
+ public static RIGHT_BTN_DRAG = false;
private _selectOnLoaded: string = ""; // id of document that should be selected once it's loaded (used for click-to-type)
private _lastX: number = 0;
private _lastY: number = 0;
@@ -112,16 +113,17 @@ export class CollectionFreeFormView extends CollectionSubView {
var dv = DocumentManager.Instance.getDocumentView(doc);
return childSelected || (dv && SelectionManager.IsSelected(dv) ? true : false);
}, false);
- // bcz:RightBtnDrag
- //if (((e.button === 2 && (!this.isAnnotationOverlay || this.zoomScaling() !== 1)) || (e.button === 0 && e.altKey)) && (childSelected || this.props.active())) {
- if ((e.button === 0 && !e.altKey && (!this.isAnnotationOverlay || this.zoomScaling() !== 1)) && (childSelected || this.props.active())) {
+ if ((CollectionFreeFormView.RIGHT_BTN_DRAG &&
+ (((e.button === 2 && (!this.isAnnotationOverlay || this.zoomScaling() !== 1)) ||
+ (e.button === 0 && e.altKey)) && (childSelected || this.props.active()))) ||
+ (!CollectionFreeFormView.RIGHT_BTN_DRAG &&
+ ((e.button === 0 && !e.altKey && (!this.isAnnotationOverlay || this.zoomScaling() !== 1)) && (childSelected || this.props.active())))) {
document.removeEventListener("pointermove", this.onPointerMove);
document.addEventListener("pointermove", this.onPointerMove);
document.removeEventListener("pointerup", this.onPointerUp);
document.addEventListener("pointerup", this.onPointerUp);
this._lastX = e.pageX;
this._lastY = e.pageY;
- e.stopPropagation();
}
}
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index b44cc9d37..a1dcb4194 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -11,7 +11,6 @@ import { undoBatch } from "../../../util/UndoManager";
import { InkingCanvas } from "../../InkingCanvas";
import { PreviewCursor } from "../../PreviewCursor";
import { CollectionFreeFormView } from "./CollectionFreeFormView";
-import { MINIMIZED_ICON_SIZE } from '../../../views/globalCssVariables.scss'
import "./MarqueeView.scss";
import React = require("react");
@@ -70,9 +69,8 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
}
@action
onPointerDown = (e: React.PointerEvent): void => {
- // bcz:RightBtnDrag
- //if (e.buttons === 1 && !e.altKey && !e.metaKey && this.props.container.props.active()) {
- if (!e.metaKey && (e.altKey || this.props.container.props.active())) {
+ if ((CollectionFreeFormView.RIGHT_BTN_DRAG && (e.buttons === 1 && !e.altKey && !e.metaKey && this.props.container.props.active())) ||
+ (!CollectionFreeFormView.RIGHT_BTN_DRAG && (!e.metaKey && (e.altKey || this.props.container.props.active())))) {
this._downX = this._lastX = e.pageX;
this._downY = this._lastY = e.pageY;
this._used = false;
@@ -97,13 +95,13 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
this._showOnUp = false;
PreviewCursor.Visible = false;
}
- //bcz:RightBtnDrag
- //if (!this._used && e.buttons === 1 && !e.altKey && !e.metaKey &&
- if (!this._used && (e.buttons === 2 || e.altKey) && !e.metaKey &&
- (Math.abs(this._lastX - this._downX) > MarqueeView.DRAG_THRESHOLD || Math.abs(this._lastY - this._downY) > MarqueeView.DRAG_THRESHOLD)) {
- this._visible = true;
- e.stopPropagation();
- e.preventDefault();
+ if ((CollectionFreeFormView.RIGHT_BTN_DRAG && (!this._used && e.buttons === 1 && !e.altKey && !e.metaKey)) ||
+ (!CollectionFreeFormView.RIGHT_BTN_DRAG && (!this._used && (e.buttons === 2 || e.altKey) && !e.metaKey))) {
+ if ((Math.abs(this._lastX - this._downX) > MarqueeView.DRAG_THRESHOLD || Math.abs(this._lastY - this._downY) > MarqueeView.DRAG_THRESHOLD)) {
+ this._visible = true;
+ e.stopPropagation();
+ e.preventDefault();
+ }
}
}
if (e.altKey)
@@ -117,9 +115,8 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
if (this._showOnUp) {
PreviewCursor.Show(this.hideCursor, this._downX, this._downY);
document.addEventListener("keypress", this.onKeyPress, false);
- //bcz:RightBtnDrag
- // } else {
- } else if (e.button === 2 || e.altKey) {
+ } else if (CollectionFreeFormView.RIGHT_BTN_DRAG ||
+ (!CollectionFreeFormView.RIGHT_BTN_DRAG && (e.button === 2 || e.altKey))) {
let mselect = this.marqueeSelect();
if (!e.shiftKey) {
SelectionManager.DeselectAll(mselect.length ? undefined : this.props.container.props.Document);
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index c82b86ea9..417ff0e9d 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -23,6 +23,7 @@ import { ContextMenu } from "../ContextMenu";
import { DocumentContentsView } from "./DocumentContentsView";
import "./DocumentView.scss";
import React = require("react");
+import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
export interface DocumentViewProps {
ContainingCollectionView: Opt<CollectionView | CollectionPDFView | CollectionVideoView>;
@@ -98,7 +99,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
onPointerDown = (e: React.PointerEvent): void => {
this._downX = e.clientX;
this._downY = e.clientY;
- if (e.button === 2 && !this.isSelected()) {
+ if (CollectionFreeFormView.RIGHT_BTN_DRAG && (e.button === 2 || (e.altKey && e.button === 0)) && !this.isSelected()) {
return;
}
if (e.shiftKey && e.buttons === 2) {