Fixed an issue where the main menu disappears intermittently as the coordinates become negative. (#3269)

This commit is contained in:
Dr.Lt.Data 2024-04-18 05:36:49 +09:00 committed by GitHub
parent c3970a24a9
commit 1a676acbbb

View File

@ -90,12 +90,15 @@ function dragElement(dragEl, settings) {
}).observe(dragEl);
function ensureInBounds() {
if (dragEl.classList.contains("comfy-menu-manual-pos")) {
try {
newPosX = Math.min(document.body.clientWidth - dragEl.clientWidth, Math.max(0, dragEl.offsetLeft));
newPosY = Math.min(document.body.clientHeight - dragEl.clientHeight, Math.max(0, dragEl.offsetTop));
positionElement();
}
catch(exception){
// robust
}
}
function positionElement() {