diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2020-05-08 16:57:30 -0400 |
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2020-05-08 16:57:30 -0400 |
| commit | c1f49a0974982b803c565b6ac3c8931be7c8972f (patch) | |
| tree | 98dcb6949b1ced239b123ed385b3568907b32535 /src/client/views/collections/collectionFreeForm | |
| parent | e627a85430345db08c03027a6b816141fb4f4a2c (diff) | |
added " " for switching between pan/zoom & marquee.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 | ||||
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/MarqueeView.tsx | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 17c1dd44a..5d3d8eb4f 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -563,7 +563,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P document.removeEventListener("pointerup", this.onPointerUp); return; } - this.pan(e); + (MarqueeView.DragState || e.altKey) && this.pan(e); } e.stopPropagation(); // doesn't actually stop propagation since all our listeners are listening to events on 'document' however it does mark the event as cancelBubble=true which we test for in the move event handlers e.preventDefault(); diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index a777f6fe5..3c67f8c6a 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -19,8 +19,6 @@ import React = require("react"); import { CognitiveServices } from "../../../cognitive_services/CognitiveServices"; import { RichTextField } from "../../../../new_fields/RichTextField"; import { CollectionView } from "../CollectionView"; -import { FormattedTextBox } from "../../nodes/formattedText/FormattedTextBox"; -import { ScriptField } from "../../../../new_fields/ScriptField"; interface MarqueeViewProps { getContainerTransform: () => Transform; @@ -39,7 +37,7 @@ interface MarqueeViewProps { @observer export class MarqueeView extends React.Component<SubCollectionViewProps & MarqueeViewProps> { - private _mainCont = React.createRef<HTMLDivElement>(); + @observable public static DragState = true; @observable _lastX: number = 0; @observable _lastY: number = 0; @observable _downX: number = 0; @@ -168,9 +166,9 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque onPointerDown = (e: React.PointerEvent): void => { this._downX = this._lastX = e.clientX; this._downY = this._lastY = e.clientY; - if (e.button === 2 || (e.button === 0 && e.altKey)) { + if (e.button === 2 || (e.button === 0 && (e.altKey || !MarqueeView.DragState))) { this.setPreviewCursor(e.clientX, e.clientY, true); - if (e.altKey) { + if (e.altKey || !MarqueeView.DragState) { //e.stopPropagation(); // bcz: removed so that you can alt-click on button in a collection to switch link following behaviors. e.preventDefault(); } @@ -195,7 +193,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque } else { this.cleanupInteractions(true); // stop listening for events if another lower-level handle (e.g. another Marquee) has stopPropagated this } - if (e.altKey) { + if (e.altKey || !MarqueeView.DragState) { e.preventDefault(); } } @@ -230,7 +228,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque }; document.addEventListener("pointerdown", hideMarquee); - if (e.altKey) { + if (e.altKey || !MarqueeView.DragState) { e.preventDefault(); } } @@ -614,7 +612,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque render() { return <div className="marqueeView" - style={{ overflow: StrCast(this.props.Document._overflow), }} + style={{ overflow: StrCast(this.props.Document._overflow), cursor: MarqueeView.DragState ? "hand" : "crosshair" }} onScroll={(e) => e.currentTarget.scrollTop = e.currentTarget.scrollLeft = 0} onClick={this.onClick} onPointerDown={this.onPointerDown}> {this._visible ? this.marqueeDiv : null} {this.props.children} |
