fix MovingUI to respect resizing topBar
This commit is contained in:
parent
8bf679cba2
commit
1a5dbf2603
|
@ -445,7 +445,7 @@ export function dragElement(elmnt) {
|
||||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||||
var height, width, top, left, right, bottom,
|
var height, width, top, left, right, bottom,
|
||||||
maxX, maxY, winHeight, winWidth,
|
maxX, maxY, winHeight, winWidth,
|
||||||
topbar, topbarWidth, topBarFirstX, topBarLastX, sheldWidth;
|
topbar, topbarWidth, topBarFirstX, topBarLastX, topBarLastY, sheldWidth;
|
||||||
|
|
||||||
var elmntName = elmnt.attr('id');
|
var elmntName = elmnt.attr('id');
|
||||||
|
|
||||||
|
@ -493,8 +493,9 @@ export function dragElement(elmnt) {
|
||||||
topbar = document.getElementById("top-bar")
|
topbar = document.getElementById("top-bar")
|
||||||
const topbarstyle = getComputedStyle(topbar)
|
const topbarstyle = getComputedStyle(topbar)
|
||||||
topBarFirstX = parseInt(topbarstyle.marginInline)
|
topBarFirstX = parseInt(topbarstyle.marginInline)
|
||||||
topbarWidth = parseInt(topbarstyle.width)
|
topbarWidth = parseInt(topbarstyle.width);
|
||||||
topBarLastX = topBarFirstX + topbarWidth;
|
topBarLastX = topBarFirstX + topbarWidth;
|
||||||
|
topBarLastY = parseInt(topbarstyle.height);
|
||||||
|
|
||||||
/*console.log(`
|
/*console.log(`
|
||||||
winWidth: ${winWidth}, winHeight: ${winHeight}
|
winWidth: ${winWidth}, winHeight: ${winHeight}
|
||||||
|
@ -540,7 +541,7 @@ export function dragElement(elmnt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//prevent resizing from top left into the top bar
|
//prevent resizing from top left into the top bar
|
||||||
if (top < 35 && maxX >= topBarFirstX && left <= topBarFirstX
|
if (top < topBarLastY && maxX >= topBarFirstX && left <= topBarFirstX
|
||||||
) {
|
) {
|
||||||
console.debug('prevent topbar underlap resize')
|
console.debug('prevent topbar underlap resize')
|
||||||
elmnt.css('width', width - 1 + "px");
|
elmnt.css('width', width - 1 + "px");
|
||||||
|
@ -575,7 +576,7 @@ export function dragElement(elmnt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//prevent underlap with topbar div
|
//prevent underlap with topbar div
|
||||||
if (top < 35
|
if (top < topBarLastY
|
||||||
&& (maxX >= topBarFirstX && left <= topBarFirstX //elmnt is hitting topbar from left side
|
&& (maxX >= topBarFirstX && left <= topBarFirstX //elmnt is hitting topbar from left side
|
||||||
|| left <= topBarLastX && maxX >= topBarLastX //elmnt is hitting topbar from right side
|
|| left <= topBarLastX && maxX >= topBarLastX //elmnt is hitting topbar from right side
|
||||||
|| left >= topBarFirstX && maxX <= topBarLastX) //elmnt hitting topbar in the middle
|
|| left >= topBarFirstX && maxX <= topBarLastX) //elmnt hitting topbar in the middle
|
||||||
|
|
Loading…
Reference in New Issue