From 8d63125b133d31ce33adb633ff850c937f6500bf Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Sun, 11 Nov 2018 04:28:39 -0800 Subject: [PATCH] Resetting pinch zoom (#261) * Resetting pinch zoom * Bumping version --- package.json | 2 +- src/components/Output/index.tsx | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dba7f34b..e204fc1c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "squoosh", - "version": "1.0.1", + "version": "1.0.2", "license": "apache-2.0", "scripts": { "start": "webpack serve --host 0.0.0.0 --hot", diff --git a/src/components/Output/index.tsx b/src/components/Output/index.tsx index 2c9496c9..a0481083 100644 --- a/src/components/Output/index.tsx +++ b/src/components/Output/index.tsx @@ -48,6 +48,15 @@ export default class Output extends Component { const leftDraw = this.leftDrawable(); const rightDraw = this.rightDrawable(); + // Reset the pinch zoom, which may have an position set from the previous view, after pressing + // the back button. + this.pinchZoomLeft!.setTransform({ + allowChangeEvent: true, + x: 0, + y: 0, + scale: 1, + }); + if (this.canvasLeft && leftDraw) { drawDataToCanvas(this.canvasLeft, leftDraw); }