mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -05:00
Move anchor icon load to mouse down to avoid an issue where the view hasn't loaded yet
This commit is contained in:
parent
231c98da3c
commit
3f46c04f19
1 changed files with 11 additions and 11 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue