mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
chore: use position: fixed for contextmenu
This commit is contained in:
parent
70f06e7852
commit
c844e1c03d
2 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
.umap-contextmenu {
|
.umap-contextmenu {
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
padding: calc(var(--box-padding) / 2) var(--box-padding);
|
padding: calc(var(--box-padding) / 2) var(--box-padding);
|
||||||
position: absolute;
|
position: fixed;
|
||||||
z-index: var(--zindex-contextmenu);
|
z-index: var(--zindex-contextmenu);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
box-shadow: var(--block-shadow);
|
box-shadow: var(--block-shadow);
|
||||||
|
|
|
@ -16,8 +16,8 @@ export default class ContextMenu extends Positioned {
|
||||||
}
|
}
|
||||||
|
|
||||||
open(event, items) {
|
open(event, items) {
|
||||||
const left = event.pageX
|
const left = event.clientX
|
||||||
const top = event.pageY
|
const top = event.clientY
|
||||||
this.container.innerHTML = ''
|
this.container.innerHTML = ''
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
if (item === '-') {
|
if (item === '-') {
|
||||||
|
@ -38,7 +38,7 @@ export default class ContextMenu extends Positioned {
|
||||||
this.container.appendChild(li)
|
this.container.appendChild(li)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const parent = document.elementFromPoint(event.clientX, event.clientY).offsetParent
|
const parent = document.elementFromPoint(left, top).offsetParent
|
||||||
parent.appendChild(this.container)
|
parent.appendChild(this.container)
|
||||||
if (this.options.fixed) {
|
if (this.options.fixed) {
|
||||||
this.setPosition({ left, top })
|
this.setPosition({ left, top })
|
||||||
|
|
Loading…
Reference in a new issue