fix addselection starting selection
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
cfca5d95ba
commit
92ab54282d
1 changed files with 5 additions and 11 deletions
|
@ -41,12 +41,6 @@ const stampTool = () =>
|
||||||
mouse.listen.world.btn.left.onclick.clear(state.drawcb);
|
mouse.listen.world.btn.left.onclick.clear(state.drawcb);
|
||||||
mouse.listen.world.btn.right.onclick.clear(state.cancelcb);
|
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();
|
ovLayer.clear();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -60,7 +54,7 @@ const stampTool = () =>
|
||||||
state.lastMouseMove = {x: 0, y: 0};
|
state.lastMouseMove = {x: 0, y: 0};
|
||||||
state.block_res_change = true;
|
state.block_res_change = true;
|
||||||
|
|
||||||
state.selectResource = (resource, nolock = true) => {
|
state.selectResource = (resource, nolock = true, deselect = true) => {
|
||||||
if (nolock && state.ctxmenu.uploadButton.disabled) return;
|
if (nolock && state.ctxmenu.uploadButton.disabled) return;
|
||||||
|
|
||||||
console.debug(
|
console.debug(
|
||||||
|
@ -83,14 +77,14 @@ const stampTool = () =>
|
||||||
resourceWrapper && resourceWrapper.classList.add("active");
|
resourceWrapper && resourceWrapper.classList.add("active");
|
||||||
state.selected = resource;
|
state.selected = resource;
|
||||||
}
|
}
|
||||||
// If already selected, clear selection
|
// If already selected, clear selection (if deselection is enabled)
|
||||||
else {
|
else if (deselect){
|
||||||
resourceWrapper.classList.remove("active");
|
resourceWrapper.classList.remove("active");
|
||||||
state.selected = null;
|
state.selected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ovLayer.clear();
|
ovLayer.clear();
|
||||||
if (state.loaded) state.movecb(state.lastMouseMove);
|
if (state.loaded) state.redraw();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open IndexedDB connection
|
// Open IndexedDB connection
|
||||||
|
@ -277,7 +271,7 @@ const stampTool = () =>
|
||||||
syncResources();
|
syncResources();
|
||||||
|
|
||||||
// Select this resource
|
// Select this resource
|
||||||
state.selectResource(resource, nolock);
|
state.selectResource(resource, nolock, false);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue