From 51c7febb4ab845f609c2613d3180f8456f38b285 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 16 Apr 2018 21:15:39 -0400 Subject: scale proportionally rather than an absolute amount --- print/resources/inkstitch.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/print/resources/inkstitch.js b/print/resources/inkstitch.js index 253e9243..2323ec7a 100644 --- a/print/resources/inkstitch.js +++ b/print/resources/inkstitch.js @@ -78,12 +78,14 @@ $(function() { var transform = svg.css('transform').match(/-?[\d\.]+/g); var scale = parseFloat(transform[0]); - if( scale > 0.01 && (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0)) { - // scroll down - scale -= 0.01; + if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) { + // scroll down = zoom out + scale *= 0.97; + if (scale < 0.01) + scale = 0.01; } else { //scroll up - scale += 0.01; + scale *= 1.03; } // set modified scale -- cgit v1.2.3