From ebd70f323463434795f68bc54a50b02e43ff8e8e Mon Sep 17 00:00:00 2001 From: bbaer <bbaer@math.uzh.ch> Date: Wed, 1 Nov 2017 15:14:27 +0100 Subject: [PATCH] it isn't possible to select objects while drawing rectangles now --- javascript/src/Plugins/qfq.fabric.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/javascript/src/Plugins/qfq.fabric.js b/javascript/src/Plugins/qfq.fabric.js index d0f2b4158..f8e8f5519 100644 --- a/javascript/src/Plugins/qfq.fabric.js +++ b/javascript/src/Plugins/qfq.fabric.js @@ -324,9 +324,7 @@ $(function (n) { objects[i].setCoords(); } this.setBackground(); - this.userChangePossible = false; this.canvas.renderAll(); - this.userChangePossible = true; } }; @@ -531,6 +529,7 @@ $(function (n) { if (this.drawRectangleMode || this.drawTextBoxMode) { this.deactivateRectangleDrawing(); + this.activateAllObjects(); } if (this.isZoomMode) { @@ -551,9 +550,11 @@ $(function (n) { } if (this.drawRectangleMode) { this.freeDrawRectangleStart(e); + this.deactivateAllObjects(); } if (this.drawTextBoxMode) { this.freeDrawTextBoxStart(e); + this.deactivateAllObjects(); } } }; @@ -589,6 +590,7 @@ $(function (n) { break; case "write": case "rectangle": + break; case "move": break; case "delete": @@ -718,6 +720,18 @@ $(function (n) { this.canvas.renderAll(); }; + n.Fabric.prototype.deactivateAllObjects = function() { + this.canvas.forEachObject(function(object){ + object.selectable = false; + }); + }; + + n.Fabric.prototype.activateAllObjects = function() { + this.canvas.forEachObject(function(object){ + object.selectable = true; + }); + }; + /* later $("#text-bg-submit").on("click", function() { -- GitLab