aboutsummaryrefslogtreecommitdiff
path: root/src/App.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-03-23 19:19:25 +1100
committerTerry Truong <terry06890@gmail.com>2022-03-23 19:45:41 +1100
commitef6b243163eef31bbf96432ce2442be468ca96c6 (patch)
tree394b7479ec54985ccbf08082be127730c6b184f6 /src/App.vue
parent7ca13b43410364a4ac3bd109e3215a7c26814b93 (diff)
Place window-resize handling back in TileTree
Reversion done to prevent flashes on window resize.
Diffstat (limited to 'src/App.vue')
-rw-r--r--src/App.vue42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/App.vue b/src/App.vue
index 7d1c7fa..b4254e7 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -3,44 +3,6 @@ import {defineComponent} from 'vue';
import TileTree from './components/TileTree.vue';
export default defineComponent({
- data(){
- return {
- width: document.documentElement.clientWidth,
- height: document.documentElement.clientHeight,
- // For window-resize-handler throttling
- resizeThrottled: false,
- resizeDelay: 50, //ms
- }
- },
- computed: {
- styles(): Record<string,string> {
- return {
- position: 'absolute',
- left: '0',
- top: '0',
- width: this.width + 'px',
- height: this.height + 'px',
- backgroundColor: 'black',
- };
- }
- },
- methods: {
- onResize(){
- if (!this.resizeThrottled){
- this.width = document.documentElement.clientWidth;
- this.height = document.documentElement.clientHeight;
- // Prevent re-triggering until after a delay
- this.resizeThrottled = true;
- setTimeout(() => {this.resizeThrottled = false;}, this.resizeDelay);
- }
- },
- },
- created(){
- window.addEventListener('resize', this.onResize);
- },
- unmounted(){
- window.removeEventListener('resize', this.onResize);
- },
components: {
TileTree
},
@@ -48,8 +10,6 @@ export default defineComponent({
</script>
<template>
-<div :style="styles">
- <tile-tree :pos="[0, 0]" :dims="[width, height]"/>
-</div>
+<tile-tree/>
</template>