feat: clamp AddMenu to viewport
All checks were successful
🚀 Lint & Test & Deploy / release (push) Successful in 4m10s

This commit is contained in:
release-bot
2026-02-10 21:51:50 +01:00
parent a31a49ad50
commit 07cd9e84eb
5 changed files with 82 additions and 18 deletions

View File

@@ -17,9 +17,11 @@
import { MouseEventManager } from './mouse.events';
const {
keymap
keymap,
addMenuPadding
}: {
keymap: ReturnType<typeof createKeyMap>;
addMenuPadding?: { left?: number; right?: number; bottom?: number; top?: number };
} = $props();
const graph = getGraphManager();
@@ -160,7 +162,13 @@
{#if graph.status === 'idle'}
{#if graphState.addMenuPosition}
<AddMenu onnode={handleNodeCreation} />
<AddMenu
onnode={handleNodeCreation}
paddingTop={addMenuPadding?.top}
paddingRight={addMenuPadding?.right}
paddingBottom={addMenuPadding?.bottom}
paddingLeft={addMenuPadding?.left}
/>
{/if}
{#if graphState.activeSocket}

View File

@@ -18,6 +18,8 @@
showHelp?: boolean;
settingTypes?: Record<string, unknown>;
addMenuPadding?: { left?: number; right?: number; bottom?: number; top?: number };
onsave?: (save: Graph) => void;
onresult?: (result: unknown) => void;
};
@@ -25,6 +27,7 @@
let {
graph,
registry,
addMenuPadding,
settings = $bindable(),
activeNode = $bindable(),
backgroundType = $bindable('grid'),
@@ -83,4 +86,4 @@
});
</script>
<GraphEl {keymap} />
<GraphEl {keymap} {addMenuPadding} />