Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Resetting pinch zoom (#261)

Jake Archibald8d63125b133d
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<Props, State> {
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);
}