From 74afc73fe2ef81ddde57c326fbcc055449f647c4 Mon Sep 17 00:00:00 2001 From: bbaer <bbaer@math.uzh.ch> Date: Fri, 24 Nov 2017 11:19:22 +0100 Subject: [PATCH] better implementation of right click to zoom out --- javascript/src/Plugins/qfq.fabric.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/javascript/src/Plugins/qfq.fabric.js b/javascript/src/Plugins/qfq.fabric.js index 7471713b7..329f1616c 100644 --- a/javascript/src/Plugins/qfq.fabric.js +++ b/javascript/src/Plugins/qfq.fabric.js @@ -363,7 +363,7 @@ $(function (n) { this.canvas.on('selection:cleared', function(e) { that.defaultSelectionClearHandler(e) }); window.addEventListener('keydown', function(e) { that.defaultKeyStrokeHandler(e) }); window.addEventListener('dragend', function(e) { that.dragEndEvent(e) }); - this.parentElement.on('contextmenu', function(e) { that.defaultRightClickHandler(e); if(that.isZoomMode) { return false; } }); + this.parentElement.on('contextmenu', function(e) { that.defaultRightClickHandler(e) }); $(window).resize(function() { that.resizeCanvas(); }); }; @@ -377,7 +377,6 @@ $(function (n) { n.Fabric.prototype.defaultMouseInEvent = function(e) { this.mouseInsideCanvas = true; - console.log("Mouse entered Canvas"); }; n.Fabric.prototype.resizeCanvas = function () { @@ -620,13 +619,12 @@ $(function (n) { n.Fabric.prototype.defaultRightClickHandler = function(e) { if (this.isZoomMode) { this.zoomCanvas(e, -0.1); - return false; + e.preventDefault(); } }; n.Fabric.prototype.defaultMouseOutEvent = function(e) { this.mouseInsideCanvas = false; - console.log("Mouse left Canvas"); if (this.moveMode) { this.deactivatePanning(); @@ -660,13 +658,6 @@ $(function (n) { } }; - n.Fabric.prototype.defaultRightClickEvent = function(e) { - if (this.isZoomMode) { - this.zoomCanvas(e, -0.1); - return false; - } - }; - // Calls additional functions on button press, could eventually be integrated to // the button/mode json. Talk about strange integration. n.Fabric.prototype.buttonPress = function(string, $button) { -- GitLab