diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/App.vue | 24 | ||||
| -rw-r--r-- | src/components/Tile.vue | 11 |
2 files changed, 18 insertions, 17 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){ diff --git a/src/components/Tile.vue b/src/components/Tile.vue index 995e205..da3c29c 100644 --- a/src/components/Tile.vue +++ b/src/components/Tile.vue @@ -30,7 +30,7 @@ export default defineComponent({ // Used to hide overflow on tile expansion, but not hide a sepSweptArea on subsequent transitions clickHoldTimer: 0, // Used to recognise click-and-hold events scrollOffset: 0, // Used to track scroll offset when displaying with overflow - scrollThrottled: false, + pendingScrollHdlr: false, }; }, computed: { @@ -370,9 +370,12 @@ export default defineComponent({ this.$emit('info-icon-click', nodeName); }, onScroll(evt: Event){ - if (!this.scrollThrottled){ - this.scrollOffset = this.$el.scrollTop; - setTimeout(() => {this.scrollThrottled = false;}, 300); + if (this.pendingScrollHdlr == 0){ + this.pendingScrollHdlr = setTimeout(() => { + console.log('handling scroll') + this.scrollOffset = this.$el.scrollTop; + this.pendingScrollHdlr = 0; + }, 50); } }, // Other |
