From 89dbabf1d29ca7e9050c4357b920684574ef6050 Mon Sep 17 00:00:00 2001 From: raphael Date: Mon, 4 May 2020 14:40:24 +0200 Subject: [PATCH] always set tool intern to mouse while image drop is active --- src/js/whiteboard.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 4e7a3ee..9dbdd06 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -554,11 +554,8 @@ const whiteboard = { }, addImgToCanvasByUrl: function (url) { var _this = this; - var wasTextTool = false; - if (_this.tool === "text") { - wasTextTool = true; - _this.setTool("mouse"); //Set to mouse tool while dropping to prevent errors - } + var oldTool = _this.tool; + _this.setTool("mouse"); //Set to mouse tool while dropping to prevent errors _this.imgDragActive = true; _this.mouseOverlay.css({ "cursor": "default" }); var imgDiv = $('
' + @@ -574,9 +571,7 @@ const whiteboard = { _this.imgDragActive = false; _this.refreshCursorAppearance(); imgDiv.remove(); - if (wasTextTool) { - _this.setTool("text"); - } + _this.setTool(oldTool); }); imgDiv.find(".addToCanvasBtn,.addToBackgroundBtn").click(function () { var draw = $(this).attr("draw"); @@ -595,9 +590,7 @@ const whiteboard = { _this.sendFunction({ "t": "addImgBG", "draw": draw, "url": url, "d": [width, height, left, top] }); _this.drawId++; imgDiv.remove(); - if (wasTextTool) { - _this.setTool("text"); - } + _this.setTool(oldTool); }); _this.mouseOverlay.append(imgDiv); imgDiv.draggable();