From 3f46c04f195897512624d12f24a11642e58646b5 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Wed, 29 Jan 2020 12:01:01 -0500 Subject: [PATCH] Move anchor icon load to mouse down to avoid an issue where the view hasn't loaded yet --- .../selection-tools/bounding-box-tool.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/helper/selection-tools/bounding-box-tool.js b/src/helper/selection-tools/bounding-box-tool.js index b78f838c..46b49a1b 100644 --- a/src/helper/selection-tools/bounding-box-tool.js +++ b/src/helper/selection-tools/bounding-box-tool.js @@ -56,17 +56,6 @@ class BoundingBoxTool { this._modeMap[BoundingBoxModes.MOVE] = new MoveTool(mode, setSelectedItems, clearSelectedItems, onUpdateImage, switchToTextTool); this._currentCursor = null; - - if (!anchorIcon) { - paper.project.importSVG(selectionAnchorIcon, { - onLoad: function (item) { - anchorIcon = item; - item.visible = false; - item.parent = getGuideLayer(); - setGuideItem(item); - } - }); - } } /** @@ -91,6 +80,17 @@ class BoundingBoxTool { * @return {boolean} True if there was a hit, false otherwise */ onMouseDown (event, clone, multiselect, doubleClicked, hitOptions) { + if (!anchorIcon) { + paper.project.importSVG(selectionAnchorIcon, { + onLoad: function (item) { + anchorIcon = item; + item.visible = false; + item.parent = getGuideLayer(); + setGuideItem(item); + } + }); + } + if (event.event.button > 0) return; // only first mouse button const {hitResult, mode} = this._determineMode(event, multiselect, hitOptions); if (!hitResult) {