Add throttling to zoom.
authorAlexandre Segura <mex.zktk@gmail.com>
Mon, 15 May 2017 14:44:14 +0200
changeset 503 a6290b2fae6b
parent 502 89dc19ad8073
child 504 11a862e01b04
Add throttling to zoom.
src_js/iconolab-bundle/src/components/editor/Canvas.vue
--- a/src_js/iconolab-bundle/src/components/editor/Canvas.vue	Mon May 15 12:38:40 2017 +0200
+++ b/src_js/iconolab-bundle/src/components/editor/Canvas.vue	Mon May 15 14:44:14 2017 +0200
@@ -418,15 +418,16 @@
                 this.animateViewBox([0, 0, this.imageWidth, this.imageHeight]);
             },
 
-            zoomIn: function() {
+            zoomIn: _.throttle(function() {
+                console.log('zoomIn', arguments)
                 if (this.scale >= 1.9) { return; }
                 this.scale = this.scale + (1 * this.zoomFactor);
-            },
+            }, 400),
 
-            zoomOut: function() {
+            zoomOut: _.throttle(function() {
                 if (this.scale === 1) { return; }
                 this.scale = this.scale - (1 * this.zoomFactor);
-            },
+            }, 400),
 
             zoomOffset: function() {
                 return {