diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-03-07 18:02:42 -0500 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-03-07 18:02:42 -0500 |
commit | 9940924f361f1b9d65d7cc0ad1e4f6f1f4d5d318 (patch) | |
tree | fd6c660ff2a92ba5d94b10bcf4524e3c4cbe631d | |
parent | 5e13ba6e9b7e2c60aed0b5b3ac964a1d3aae57d5 (diff) | |
parent | 3e7e715a235db4da57ba22b5cce1ee3c873f5a40 (diff) |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
-rw-r--r-- | src/client/views/collections/CollectionFreeFormView.tsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index f71f2791c..1a7349201 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -99,6 +99,7 @@ export class CollectionFreeFormView extends CollectionViewBase { onPointerMove = (e: PointerEvent): void => { if (!e.cancelBubble && this.props.active()) { e.stopPropagation(); + e.preventDefault(); let x = this.props.Document.GetNumber(KeyStore.PanX, 0); let y = this.props.Document.GetNumber(KeyStore.PanY, 0); let [dx, dy] = this.getTransform().transformDirection(e.clientX - this._lastX, e.clientY - this._lastY); @@ -145,8 +146,10 @@ export class CollectionFreeFormView extends CollectionViewBase { @action private SetPan(panX: number, panY: number) { - const newPanX = Math.max((1 - this.zoomScaling) * this.nativeWidth, Math.min(0, panX)); - const newPanY = Math.max((1 - this.zoomScaling) * this.nativeHeight, Math.min(0, panY)); + var x1 = this.getLocalTransform().inverse().Scale; + var x2 = this.getTransform().inverse().Scale; + const newPanX = Math.min((1 - 1 / x1) * this.nativeWidth, Math.max(0, panX)); + const newPanY = Math.min((1 - 1 / x1) * this.nativeHeight, Math.max(0, panY)); this.props.Document.SetNumber(KeyStore.PanX, this.isAnnotationOverlay ? newPanX : panX); this.props.Document.SetNumber(KeyStore.PanY, this.isAnnotationOverlay ? newPanY : panY); } |