fix: allow to call contextmenu with given positions

This commit is contained in:
Yohan Boniface 2024-10-05 11:26:05 +02:00
parent c844e1c03d
commit 3c0d2b79ef
2 changed files with 6 additions and 1 deletions

View file

@ -15,9 +15,14 @@ export default class ContextMenu extends Positioned {
}) })
} }
open(event, items) { open(event, items) {
const left = event.clientX const left = event.clientX
const top = event.clientY const top = event.clientY
this.openAt([left, top], items)
}
openAt([left, top], items) {
this.container.innerHTML = '' this.container.innerHTML = ''
for (const item of items) { for (const item of items) {
if (item === '-') { if (item === '-') {

View file

@ -663,7 +663,7 @@ const ControlsMixin = {
button.addEventListener('click', () => { button.addEventListener('click', () => {
const x = button.offsetLeft const x = button.offsetLeft
const y = button.offsetTop + button.offsetHeight const y = button.offsetTop + button.offsetHeight
menu.open([x, y], actions) menu.openAt([x, y], actions)
}) })
} }
this.help.getStartedLink(rightContainer) this.help.getStartedLink(rightContainer)