Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix searchbox immediate dismiss issue #171

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/NodeSearchBoxPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<Dialog
v-model:visible="visible"
pt:root:class="invisible-dialog-root"
dismissable-mask
modal
:dismissable-mask="dismissable"
@hide="clearFilters"
>
<template #container>
<NodeSearchBox
Expand Down Expand Up @@ -42,6 +43,7 @@ interface LiteGraphPointerEvent extends Event {
}

const visible = ref(false);
const dismissable = ref(true);
const triggerEvent = ref<LiteGraphCanvasEvent | null>(null);
const getNewNodeLocation = (): [number, number] => {
if (triggerEvent.value === null) {
Expand All @@ -66,7 +68,6 @@ const clearFilters = () => {
nodeFilters.splice(0, nodeFilters.length);
};
const closeDialog = () => {
clearFilters();
visible.value = false;
};
const connectNodeOnLinkRelease = (
Expand Down Expand Up @@ -137,6 +138,11 @@ const canvasEventHandler = (e: LiteGraphCanvasEvent) => {
}
triggerEvent.value = e;
visible.value = true;
// Prevent the dialog from being dismissed immediately
dismissable.value = false;
setTimeout(() => {
dismissable.value = true;
}, 300);
};

const handleEscapeKeyPress = (event) => {
Expand Down
Loading