diff --git a/packages/frontend/src/components/MkMenu.vue b/packages/frontend/src/components/MkMenu.vue
index 62c39d90a6..5189828399 100644
--- a/packages/frontend/src/components/MkMenu.vue
+++ b/packages/frontend/src/components/MkMenu.vue
@@ -209,7 +209,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.none }}
-
+
@@ -242,6 +242,8 @@ const props = defineProps<{
align?: 'center' | string;
width?: number;
maxHeight?: number;
+ debugDisablePredictionCone?: boolean;
+ debugShowPredictionCone?: boolean;
}>();
const emit = defineEmits<{
@@ -485,6 +487,7 @@ const guardEndY1 = ref(0);
const guardEndY2 = ref(0);
function parentMouseMove(item: MenuParent, ev: MouseEvent) {
+ if (props.debugDisablePredictionCone) return;
if (child.value == null || child.value.rootElement == null) return;
const itemBounding = (ev.currentTarget as HTMLElement).getBoundingClientRect();
@@ -794,6 +797,9 @@ function onMouseLeave() {
width: 100%;
height: 100%;
cursor: pointer;
- //background: #f004;
+
+ &.showGuard {
+ background: #f004;
+ }
}
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 52940a5b0f..1ed19ae72c 100644
--- a/packages/frontend/src/pages/debug.vue
+++ b/packages/frontend/src/pages/debug.vue
@@ -32,7 +32,11 @@ SPDX-License-Identifier: AGPL-3.0-only
Question
- select
+
+ select without guard
+ select with guard
+ select with guard (visualize)
+
@@ -76,7 +80,7 @@ const {
initialValue: 'info',
});
-function select(ev: PointerEvent) {
+function select(ev: PointerEvent, enablePredictionCone: boolean, showPredictionCone: boolean) {
os.popupMenu([
{ type: 'parent', text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', children: [
{ text: 'Option', action: () => {} },
@@ -109,7 +113,10 @@ function select(ev: PointerEvent) {
{ text: 'Option', action: () => {} },
{ text: 'Option', action: () => {} },
] },
- ], ev.target).then((value) => {
+ ], ev.currentTarget ?? ev.target, {
+ debugDisablePredictionCone: !enablePredictionCone,
+ debugShowPredictionCone: showPredictionCone,
+ }).then((value) => {
console.log('Selected:', value);
});
}