1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-27 09:34:39 +02:00
This commit is contained in:
syuilo
2025-08-25 13:46:22 +09:00
parent 2b9706a68b
commit 7924daf7f8
17 changed files with 31 additions and 31 deletions

View File

@@ -16,7 +16,7 @@ import type { MenuItem } from '@/types/menu.js';
const props = defineProps<{
items: MenuItem[];
targetElement: HTMLElement;
anchorElement: HTMLElement;
rootElement: HTMLElement;
width?: number;
}>();
@@ -36,10 +36,10 @@ const SCROLLBAR_THICKNESS = 16;
function setPosition() {
if (el.value == null) return;
const rootRect = props.rootElement.getBoundingClientRect();
const parentRect = props.targetElement.getBoundingClientRect();
const parentRect = props.anchorElement.getBoundingClientRect();
const myRect = el.value.getBoundingClientRect();
let left = props.targetElement.offsetWidth;
let left = props.anchorElement.offsetWidth;
let top = (parentRect.top - rootRect.top) - 8;
if (rootRect.left + left + myRect.width >= (window.innerWidth - SCROLLBAR_THICKNESS)) {
left = -myRect.width;
@@ -59,7 +59,7 @@ function onChildClosed(actioned?: boolean) {
}
}
watch(() => props.targetElement, () => {
watch(() => props.anchorElement, () => {
setPosition();
});