Skip to content

Commit

Permalink
Fixed an issue where the main menu disappears intermittently as the c…
Browse files Browse the repository at this point in the history
…oordinates become negative. (comfyanonymous#3269)
  • Loading branch information
ltdrdata authored Apr 17, 2024
1 parent abc69ca commit 072e3bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 072e3bd

Please sign in to comment.