Fix error where context menu appears with wrong offset when right clicking items list.
This commit is contained in:
parent
ffaede4317
commit
03fc076ac7
|
@ -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
|
||||||
|
@ -2747,8 +2749,24 @@ export default {
|
||||||
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