mirror of
https://github.com/umap-project/umap.git
synced 2025-04-30 20:12:37 +02:00
fix: allow to call contextmenu with given positions
This commit is contained in:
parent
c844e1c03d
commit
3c0d2b79ef
2 changed files with 6 additions and 1 deletions
|
@ -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 === '-') {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue