diff options
author | Hannah Chow <hannah_chow@brown.edu> | 2019-03-07 01:27:12 -0500 |
---|---|---|
committer | Hannah Chow <hannah_chow@brown.edu> | 2019-03-07 01:27:12 -0500 |
commit | 6bd826932b3c749c89581debe3eed0380ede9e4e (patch) | |
tree | 0386080787fb1342991a0288d06f66c37ff3d36b | |
parent | b0fc6546a4a0461611e8daac2f6dae31618f24e5 (diff) | |
parent | 3e7e715a235db4da57ba22b5cce1ee3c873f5a40 (diff) |
yeet
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | src/client/views/collections/CollectionFreeFormView.tsx | 7 | ||||
-rw-r--r-- | src/server/index.ts | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore index d26c7464b..2f9680a59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -dist/
\ No newline at end of file +dist/ +.DS_Store diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index bc2c1c68d..7e81e1e4a 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -102,6 +102,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); @@ -148,8 +149,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); } diff --git a/src/server/index.ts b/src/server/index.ts index 56881e254..4c2e09661 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -85,6 +85,10 @@ app.get("/hello", (req, res) => { res.send("<p>Hello</p>"); }) +app.use("/corsProxy", (req, res) => { + req.pipe(request(req.url.substring(1))).pipe(res); +}); + app.get("/delete", (req, res) => { deleteAll(); res.redirect("/"); |