Browse Source

Improve scroll zoom handling (#50)

* decrease the step size of each zoom operation

* use same stepping on all browsers

* replace math.sign with polyfill
dev_h
finnboeger 5 years ago
parent
commit
2f46c013c2
No account linked to committer's email address
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      client-data/js/board.js
  2. 1
    1
      client-data/tools/zoom/zoom.js

+ 1
- 1
client-data/js/board.js View File

@@ -318,7 +318,7 @@ function updateDocumentTitle() {
318 318
 		clearTimeout(scrollTimeout);
319 319
 		scrollTimeout = setTimeout(function updateHistory() {
320 320
 			var hash = '#' + (x | 0) + ',' + (y | 0) + ',' + Tools.getScale().toFixed(1);
321
-			if (Date.now() - lastStateUpdate > 5000 && hash != window.location.hash) {
321
+			if (Date.now() - lastStateUpdate > 5000 && hash !== window.location.hash) {
322 322
 				window.history.pushState({}, "", hash);
323 323
 				lastStateUpdate = Date.now();
324 324
 			} else {

+ 1
- 1
client-data/tools/zoom/zoom.js View File

@@ -86,7 +86,7 @@
86 86
             var x = evt.pageX / scale;
87 87
             var y = evt.pageY / scale;
88 88
             setOrigin(x, y, evt, false);
89
-            animate((1 - evt.deltaY * ZOOM_FACTOR / 10) * Tools.getScale());
89
+            animate((1 - ((evt.deltaY > 0) - (evt.deltaY < 0)) * 0.25) * Tools.getScale());
90 90
         } else {
91 91
             window.scrollTo(window.scrollX + evt.deltaX, window.scrollY + evt.deltaY);
92 92
         }

Loading…
Cancel
Save