diff --git a/packages/frontend/src/components/MkMenu.child.vue b/packages/frontend/src/components/MkMenu.child.vue index 37c3a3f5e3..ec983c270f 100644 --- a/packages/frontend/src/components/MkMenu.child.vue +++ b/packages/frontend/src/components/MkMenu.child.vue @@ -5,7 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only @@ -19,6 +27,8 @@ const props = defineProps<{ anchorElement: HTMLElement; rootElement: HTMLElement; width?: number; + debugDisablePredictionCone?: boolean; + debugShowPredictionCone?: boolean; }>(); const emit = defineEmits<{ @@ -80,6 +90,7 @@ onUnmounted(() => { }); defineExpose({ + rootElement: el, checkHit: (ev: MouseEvent) => { return (ev.target === el.value || el.value?.contains(ev.target as Node)); }, diff --git a/packages/frontend/src/components/MkMenu.vue b/packages/frontend/src/components/MkMenu.vue index b618dab6b2..26db8e1b5b 100644 --- a/packages/frontend/src/components/MkMenu.vue +++ b/packages/frontend/src/components/MkMenu.vue @@ -27,6 +27,8 @@ SPDX-License-Identifier: AGPL-3.0-only }" @keydown.stop="() => {}" @contextmenu.self.prevent="() => {}" + @mousemove.passive="onMouseMove" + @mouseleave.passive="onMouseLeave" > diff --git a/packages/frontend/src/components/MkPopupMenu.vue b/packages/frontend/src/components/MkPopupMenu.vue index 4942ffe232..11b116d430 100644 --- a/packages/frontend/src/components/MkPopupMenu.vue +++ b/packages/frontend/src/components/MkPopupMenu.vue @@ -4,8 +4,31 @@ SPDX-License-Identifier: AGPL-3.0-only --> @@ -21,6 +44,8 @@ defineProps<{ width?: number; anchorElement?: HTMLElement | null; returnFocusTo?: HTMLElement | null; + debugDisablePredictionCone?: boolean; + debugShowPredictionCone?: boolean; }>(); const emit = defineEmits<{ diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index f7b59612c4..8e78127e8e 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -640,6 +640,8 @@ export function popupMenu(items: (MenuItem | null)[], anchorElement?: HTMLElemen width?: number; onClosing?: () => void; onClosed?: () => void; + debugDisablePredictionCone?: boolean; + debugShowPredictionCone?: boolean; }): Promise { if (!(anchorElement instanceof HTMLElement)) { anchorElement = null; @@ -653,6 +655,8 @@ export function popupMenu(items: (MenuItem | null)[], anchorElement?: HTMLElemen width: options?.width, align: options?.align, returnFocusTo, + debugDisablePredictionCone: options?.debugDisablePredictionCone, + debugShowPredictionCone: options?.debugShowPredictionCone, }, { closed: () => { resolve(); diff --git a/packages/frontend/src/pages/debug.vue b/packages/frontend/src/pages/debug.vue index 9c0761f0b1..44418d613b 100644 --- a/packages/frontend/src/pages/debug.vue +++ b/packages/frontend/src/pages/debug.vue @@ -7,30 +7,46 @@ SPDX-License-Identifier: AGPL-3.0-only
- - - - + + - - - - - - - +
+ + + + -
- Error - Warning - Info - Success - Question -
+ + + + + + + + +
+ Error + Warning + Info + Success + Question +
+
+
+ + + + +
+ select without guard + select with guard + select with guard (visualize) +
+
@@ -47,6 +63,7 @@ import MkSelect from '@/components/MkSelect.vue'; import MkButton from '@/components/MkButton.vue'; import { useMkSelect } from '@/composables/use-mkselect.js'; import * as os from '@/os.js'; +import MkFolder from '@/components/MkFolder.vue'; const { model: resultType, @@ -74,6 +91,64 @@ const { initialValue: 'info', }); +function select(ev: PointerEvent, enablePredictionCone: boolean, showPredictionCone: boolean) { + os.popupMenu([ + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', action: () => {} }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + ] }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { text: 'Option', action: () => {} }, + { text: 'Option', action: () => {} }, + ] }, + { type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [ + { text: 'Option', action: () => {} }, + ] }, + ], ev.currentTarget ?? ev.target, { + debugDisablePredictionCone: !enablePredictionCone, + debugShowPredictionCone: showPredictionCone, + }).then((value) => { + console.log('Selected:', value); + }); +} + definePage(() => ({ title: 'DEBUG ROOM', icon: 'ti ti-help-circle',