aboutsummaryrefslogtreecommitdiff
path: root/src/App.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-05-15 18:30:27 +1000
committerTerry Truong <terry06890@gmail.com>2022-05-15 18:30:27 +1000
commita840a16c6bd5aef906bd5cbce8293fc863cb5a5d (patch)
tree2cd2df2b6b9d01a6f352c99dc4ba31ce9cb8743d /src/App.vue
parent61de82ca945685f98aad0d0c408c39e9762e2fc8 (diff)
Adjust resize/scroll throttling to reliably include end cases
Diffstat (limited to 'src/App.vue')
-rw-r--r--src/App.vue24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/App.vue b/src/App.vue
index 3cabecd..988309e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -116,8 +116,7 @@ export default defineComponent({
// For window-resize handling
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
- resizeThrottled: false,
- resizeDelay: 50, //ms (increasing to 100 seems to cause resize-skipping when opening browser mobile-view)
+ pendingResizeHdlr: 0, // Set to a setTimeout() value
// Other
excessTolNodeThreshold: 1000, // Threshold where excess tolMap entries are removed (done on tile collapse)
};
@@ -532,17 +531,16 @@ export default defineComponent({
},
// For other events
onResize(){
- if (!this.resizeThrottled){
- this.width = document.documentElement.clientWidth;
- this.height = document.documentElement.clientHeight;
- this.uiOpts.scrollGap = getScrollBarWidth();
- // Re-layout
- tryLayout(this.activeRoot, this.tileAreaPos, this.tileAreaDims, this.lytOpts,
- {allowCollapse: true, layoutMap: this.layoutMap});
- this.overflownRoot = false;
- // Prevent re-triggering until after a delay
- this.resizeThrottled = true;
- setTimeout(() => {this.resizeThrottled = false;}, this.resizeDelay);
+ if (this.pendingResizeHdlr == 0){
+ this.pendingResizeHdlr = setTimeout(() => {
+ this.width = document.documentElement.clientWidth;
+ this.height = document.documentElement.clientHeight;
+ this.uiOpts.scrollGap = getScrollBarWidth();
+ tryLayout(this.activeRoot, this.tileAreaPos, this.tileAreaDims, this.lytOpts,
+ {allowCollapse: true, layoutMap: this.layoutMap});
+ this.overflownRoot = false;
+ this.pendingResizeHdlr = 0;
+ }, 100);
}
},
onKeyUp(evt: KeyboardEvent){