From 92ab54282d12f98156d3a7a30a9185fa17ad0716 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Fri, 23 Dec 2022 22:18:37 -0300 Subject: [PATCH] fix addselection starting selection Signed-off-by: Victor Seiji Hariki --- js/ui/tool/stamp.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/js/ui/tool/stamp.js b/js/ui/tool/stamp.js index 2699841..a7895c7 100644 --- a/js/ui/tool/stamp.js +++ b/js/ui/tool/stamp.js @@ -41,12 +41,6 @@ const stampTool = () => mouse.listen.world.btn.left.onclick.clear(state.drawcb); mouse.listen.world.btn.right.onclick.clear(state.cancelcb); - // Deselect - state.selected = null; - Array.from(state.ctxmenu.resourceList.children).forEach((child) => { - child.classList.remove("active"); - }); - ovLayer.clear(); }, { @@ -60,7 +54,7 @@ const stampTool = () => state.lastMouseMove = {x: 0, y: 0}; state.block_res_change = true; - state.selectResource = (resource, nolock = true) => { + state.selectResource = (resource, nolock = true, deselect = true) => { if (nolock && state.ctxmenu.uploadButton.disabled) return; console.debug( @@ -83,14 +77,14 @@ const stampTool = () => resourceWrapper && resourceWrapper.classList.add("active"); state.selected = resource; } - // If already selected, clear selection - else { + // If already selected, clear selection (if deselection is enabled) + else if (deselect){ resourceWrapper.classList.remove("active"); state.selected = null; } ovLayer.clear(); - if (state.loaded) state.movecb(state.lastMouseMove); + if (state.loaded) state.redraw(); }; // Open IndexedDB connection @@ -277,7 +271,7 @@ const stampTool = () => syncResources(); // Select this resource - state.selectResource(resource, nolock); + state.selectResource(resource, nolock, false); return resource; };