Fix error where context menu appears with wrong offset when right clicking items list.
This commit is contained in:
parent
ff557baaa9
commit
fdf52eafd4
|
@ -110,7 +110,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-wrapper">
|
<div
|
||||||
|
ref="tainacan-admin-items-list-wrapper"
|
||||||
|
class="table-wrapper">
|
||||||
|
|
||||||
<!-- Context menu for right click selection -->
|
<!-- Context menu for right click selection -->
|
||||||
<div
|
<div
|
||||||
|
@ -2744,11 +2746,27 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRightClickItem($event, item) {
|
onRightClickItem($event, item) {
|
||||||
if (!this.$adminOptions.itemsSearchSelectionMode) {
|
if ( !this.$adminOptions.itemsSearchSelectionMode ) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
|
|
||||||
this.cursorPosX = $event.clientX;
|
let wrapperOffsetX = 0;
|
||||||
this.cursorPosY = $event.clientY;
|
let wrapperOffsetY = 0;
|
||||||
|
|
||||||
|
// These elements have 'container-type: inline-size;', thus they need to be positioned relative to parent
|
||||||
|
if (
|
||||||
|
( this.viewMode == 'masonry' || this.viewMode == 'records' ) &&
|
||||||
|
this.$refs &&
|
||||||
|
this.$refs['tainacan-admin-items-list-wrapper']
|
||||||
|
) {
|
||||||
|
const wrapperOffsets = this.$refs['tainacan-admin-items-list-wrapper'].getClientRects();
|
||||||
|
if ( wrapperOffsets.length && wrapperOffsets[0].top && wrapperOffsets[0].left ) {
|
||||||
|
wrapperOffsetX = wrapperOffsets[0].left;
|
||||||
|
wrapperOffsetY = wrapperOffsets[0].top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cursorPosX = $event.clientX - wrapperOffsetX;
|
||||||
|
this.cursorPosY = $event.clientY - wrapperOffsetY;
|
||||||
this.contextMenuItem = item;
|
this.contextMenuItem = item;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
min-height: 50vh;
|
min-height: 50vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.table-wrapper {
|
.table-wrapper:has(.tainacan-masonry-container),
|
||||||
|
.table-wrapper:has(.tainacan-masonry-container--skeleton) {
|
||||||
@supports (contain: inline-size) {
|
@supports (contain: inline-size) {
|
||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
container-name: tablewrapper;
|
container-name: tablewrapper;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
min-height: 50vh;
|
min-height: 50vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.table-wrapper {
|
.table-wrapper:has(.tainacan-records-container)
|
||||||
|
.table-wrapper:has(.tainacan-records-container--skeleton) {
|
||||||
@supports (contain: inline-size) {
|
@supports (contain: inline-size) {
|
||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
container-name: tablewrapper;
|
container-name: tablewrapper;
|
||||||
|
|
Loading…
Reference in New Issue