From 1a5dbf26032f78e6695e05be5b6a73532422a251 Mon Sep 17 00:00:00 2001 From: RossAscends <124905043+RossAscends@users.noreply.github.com> Date: Mon, 28 Aug 2023 01:40:40 +0900 Subject: [PATCH] fix MovingUI to respect resizing topBar --- public/scripts/RossAscends-mods.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index bf0548b58..cbf9b6a3f 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -445,7 +445,7 @@ export function dragElement(elmnt) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; var height, width, top, left, right, bottom, maxX, maxY, winHeight, winWidth, - topbar, topbarWidth, topBarFirstX, topBarLastX, sheldWidth; + topbar, topbarWidth, topBarFirstX, topBarLastX, topBarLastY, sheldWidth; var elmntName = elmnt.attr('id'); @@ -493,8 +493,9 @@ export function dragElement(elmnt) { topbar = document.getElementById("top-bar") const topbarstyle = getComputedStyle(topbar) topBarFirstX = parseInt(topbarstyle.marginInline) - topbarWidth = parseInt(topbarstyle.width) + topbarWidth = parseInt(topbarstyle.width); topBarLastX = topBarFirstX + topbarWidth; + topBarLastY = parseInt(topbarstyle.height); /*console.log(` winWidth: ${winWidth}, winHeight: ${winHeight} @@ -540,7 +541,7 @@ export function dragElement(elmnt) { } //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') elmnt.css('width', width - 1 + "px"); @@ -575,7 +576,7 @@ export function dragElement(elmnt) { } //prevent underlap with topbar div - if (top < 35 + if (top < topBarLastY && (maxX >= topBarFirstX && left <= topBarFirstX //elmnt is hitting topbar from left side || left <= topBarLastX && maxX >= topBarLastX //elmnt is hitting topbar from right side || left >= topBarFirstX && maxX <= topBarLastX) //elmnt hitting topbar in the middle