Fixed userlist breaking the page layout

This commit is contained in:
rainbow napkin 2024-12-05 04:46:57 -05:00
parent a20bb99af2
commit 3f0af3a519
3 changed files with 26 additions and 6 deletions

View file

@ -222,10 +222,8 @@ class canopyUXUtils{
//If we let go here, the width isn't breaking anything so there's nothing to fix.
this.fixWidth = false;
}else{
//We need to move the element back, but we can't do it all the way while we're still dragging as it will thrash
this.element.style.width = `${this.calcWidth(this.element.getBoundingClientRect().width + pageBreak - 1)}vw`;
//If we stop dragging here, let the endDrag function know to fix the pixel difference used to prevent thrashing
this.fixWidth = true;
//call fixCutoff with standalone mode off, and a pre-calculated pageBreak
this.fixCutoff(false, pageBreak);
}
}
}
@ -234,6 +232,19 @@ class canopyUXUtils{
return (px / window.innerWidth) * 100;
}
fixCutoff(standalone = true, pageBreak = document.body.scrollWidth - document.body.getBoundingClientRect().width){
//We need to move the element back, but we can't do it all the way while we're still dragging as it will thrash
this.element.style.width = `${this.calcWidth(this.element.getBoundingClientRect().width + pageBreak - 1)}vw`;
//If we stop dragging here, let the endDrag function know to fix the pixel difference used to prevent thrashing
this.fixWidth = true;
//If we're calling this outside of drag()
if(standalone){
//call end drag to finish the job
this.endDrag();
}
}
}
}