refactor(svelte): reset selection on context menu
This commit is contained in:
@@ -23,7 +23,8 @@
|
|||||||
multiselectionKeyPressed,
|
multiselectionKeyPressed,
|
||||||
deleteKeyPressed,
|
deleteKeyPressed,
|
||||||
panActivationKeyPressed,
|
panActivationKeyPressed,
|
||||||
zoomActivationKeyPressed
|
zoomActivationKeyPressed,
|
||||||
|
selectionRect
|
||||||
} = useStore();
|
} = useStore();
|
||||||
|
|
||||||
function isKeyObject(key?: KeyDefinition | null): key is KeyDefinitionObject {
|
function isKeyObject(key?: KeyDefinition | null): key is KeyDefinitionObject {
|
||||||
@@ -60,7 +61,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetAll() {
|
function resetKeysAndSelection() {
|
||||||
|
selectionRect.set(null);
|
||||||
selectionKeyPressed.set(false);
|
selectionKeyPressed.set(false);
|
||||||
multiselectionKeyPressed.set(false);
|
multiselectionKeyPressed.set(false);
|
||||||
deleteKeyPressed.set(false);
|
deleteKeyPressed.set(false);
|
||||||
@@ -70,8 +72,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window
|
<svelte:window
|
||||||
on:blur={resetAll}
|
on:blur={resetKeysAndSelection}
|
||||||
on:contextmenu={resetAll}
|
on:contextmenu={resetKeysAndSelection}
|
||||||
use:shortcut={{
|
use:shortcut={{
|
||||||
trigger: getShortcutTrigger(selectionKey, () => selectionKeyPressed.set(true)),
|
trigger: getShortcutTrigger(selectionKey, () => selectionKeyPressed.set(true)),
|
||||||
type: 'keydown'
|
type: 'keydown'
|
||||||
|
|||||||
Reference in New Issue
Block a user