Fixed weird bug with child clickdragger resizing
This commit is contained in:
parent
7fb981d778
commit
99e76d72f4
|
|
@ -191,10 +191,10 @@ class canopyUXUtils{
|
|||
//we're no longer dragging
|
||||
this.dragLock = false;
|
||||
|
||||
//if we broke the page we need to fix it
|
||||
//if we fudged the numbers to keep the page from breaking
|
||||
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)}vw`;
|
||||
//set everything straight
|
||||
this.fixCutoff();
|
||||
//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;
|
||||
}
|
||||
|
|
@ -237,21 +237,26 @@ class canopyUXUtils{
|
|||
|
||||
|
||||
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 we're calling this outside of drag() (regardless of draglock unless set otherwise)
|
||||
if(standalone){
|
||||
//Fix the page width, don't fudge numbers, we don't need to
|
||||
this.element.style.width = `${this.calcWidth(this.element.getBoundingClientRect().width + pageBreak)}vw`;
|
||||
//Tell endDrag() function not to put us in a recursive loop
|
||||
this.fixWidth = false;
|
||||
//call end drag to finish the job
|
||||
this.endDrag();
|
||||
}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;
|
||||
}
|
||||
|
||||
//If we have a parent dragger
|
||||
if(this.parent != null){
|
||||
//Make sure to fix it's cutoff too
|
||||
this.parent.fixCutoff();
|
||||
this.parent.fixCutoff(!this.dragLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue