diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-04-16 21:15:39 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-04-16 21:15:39 -0400 |
| commit | 51c7febb4ab845f609c2613d3180f8456f38b285 (patch) | |
| tree | 94a9a11ef67916403b9f22a4f6a687a6a3581e84 /print/resources/inkstitch.js | |
| parent | 5d0c7134031815595d90a16d2edf39c5e757411d (diff) | |
scale proportionally rather than an absolute amount
Diffstat (limited to 'print/resources/inkstitch.js')
| -rw-r--r-- | print/resources/inkstitch.js | 10 |
1 files 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 |
