fix: fix the unexpected behavior of the ConfirmDialog popup (#4252)
* fix: fix top and left styles of the container by subtracting the margin-top and margin-left * fix: create getComputedStyle variable * fix: add subtracting of margins in else condition --------- Co-authored-by: Dmytro Lukashenko <ext.dmytro.lukashenko@swarco.de>pull/3943/head^2
parent
e14c7186d8
commit
ff5b2f7fe6
|
@ -323,24 +323,27 @@ export default {
|
||||||
let leftPos = offset.left + deltaX;
|
let leftPos = offset.left + deltaX;
|
||||||
let topPos = offset.top + deltaY;
|
let topPos = offset.top + deltaY;
|
||||||
let viewport = DomHandler.getViewport();
|
let viewport = DomHandler.getViewport();
|
||||||
|
let getComputedStyle = getComputedStyle(this.container)
|
||||||
|
let marginLeft = parseFloat(getComputedStyle.marginLeft);
|
||||||
|
let marginTop = parseFloat(getComputedStyle.marginTop);
|
||||||
|
|
||||||
this.container.style.position = 'fixed';
|
this.container.style.position = 'fixed';
|
||||||
|
|
||||||
if (this.keepInViewport) {
|
if (this.keepInViewport) {
|
||||||
if (leftPos >= this.minX && leftPos + width < viewport.width) {
|
if (leftPos >= this.minX && leftPos + width < viewport.width) {
|
||||||
this.lastPageX = event.pageX;
|
this.lastPageX = event.pageX;
|
||||||
this.container.style.left = leftPos + 'px';
|
this.container.style.left = (leftPos - marginLeft) + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topPos >= this.minY && topPos + height < viewport.height) {
|
if (topPos >= this.minY && topPos + height < viewport.height) {
|
||||||
this.lastPageY = event.pageY;
|
this.lastPageY = event.pageY;
|
||||||
this.container.style.top = topPos + 'px';
|
this.container.style.top = (topPos - marginTop) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.lastPageX = event.pageX;
|
this.lastPageX = event.pageX;
|
||||||
this.container.style.left = leftPos + 'px';
|
this.container.style.left = (leftPos - marginLeft) + 'px';
|
||||||
this.lastPageY = event.pageY;
|
this.lastPageY = event.pageY;
|
||||||
this.container.style.top = topPos + 'px';
|
this.container.style.top = (topPos - marginTop) + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -370,7 +373,7 @@ export default {
|
||||||
window.document.removeEventListener('mouseup', this.documentDragEndListener);
|
window.document.removeEventListener('mouseup', this.documentDragEndListener);
|
||||||
this.documentDragEndListener = null;
|
this.documentDragEndListener = null;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
maximizeIconComponent() {
|
maximizeIconComponent() {
|
||||||
|
|
Loading…
Reference in New Issue