Fixed channel layout bugs with click dragger.

This commit is contained in:
rainbow napkin 2024-12-03 05:06:40 -05:00
parent 8b52946925
commit fa6696f9d3
2 changed files with 4 additions and 5 deletions

View file

@ -6,7 +6,6 @@ class chatPreprocessor{
//Set current chat nodes
this.chatEntry = chatEntry;
this.chatBody = this.chatEntry.querySelector(".chat-entry-body");
//Split the chat body into an array of objects representing each word
//We could pass this through arguments but these functions wont be very interoperable anyways since they expect a purpose-made hashtable
this.splitBody();

View file

@ -191,7 +191,7 @@ class canopyUXUtils{
//if we broke the page we need to fix it
if(this.fixWidth){
//Pop the element width up just a bit to compensate for the extra pixel
this.element.style.width = `${this.calcWidth(this.element.getBoundingClientRect().width + 1)}%`;
this.element.style.width = `${this.calcWidth(this.element.getBoundingClientRect().width + 1)}vw`;
//if this is true, it no longer needs to be, though it *should* be reset by the drag function by the time it matters anywho :P
this.fixWidth = false;
}
@ -218,12 +218,12 @@ class canopyUXUtils{
//if we're not breaking the page, or we're moving left
if(pageBreak <= 0 || event.clientX < this.handle.getBoundingClientRect().left){
//Apply difference to width
this.element.style.width = `${this.calcWidth(difference)}%`;
this.element.style.width = `${this.calcWidth(difference)}vw`;
//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)}%`;
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;
}
@ -231,7 +231,7 @@ class canopyUXUtils{
}
calcWidth(px){
return (px / this.element.parentElement.getBoundingClientRect().width) * 100;
return (px / window.innerWidth) * 100;
}
}