From b700d1ae15e0a5380eaf7cc677a3abf17620d5d4 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sun, 22 Jan 2023 23:30:45 +1100 Subject: Replace ResizeObserver using width/height props For increasing compatibility with older devices --- src/App.vue | 14 ++++- src/components/BaseLine.vue | 52 +++++++---------- src/components/TimeLine.vue | 136 ++++++++++++++++++++------------------------ src/store.ts | 2 + src/util.ts | 11 ---- 5 files changed, 95 insertions(+), 120 deletions(-) diff --git a/src/App.vue b/src/App.vue index e493433..20db479 100644 --- a/src/App.vue +++ b/src/App.vue @@ -33,13 +33,15 @@
- +
@@ -98,6 +100,14 @@ const store = useStore(); const contentWidth = ref(1); const contentHeight = ref(1); const vert = computed(() => contentHeight.value > contentWidth.value); +const timelineWidth = computed(() => { + let baseLineWidth = (store.showBaseLine && vert.value) ? store.baseLineBreadth : 0; + return (contentWidth.value - baseLineWidth) / (vert.value ? timelines.value.length : 1); +}); +const timelineHeight = computed(() => { + let baseLineHeight = (store.showBaseLine && !vert.value) ? store.baseLineBreadth : 0; + return (contentHeight.value - baseLineHeight) / (vert.value ? 1 : timelines.value.length); +}); function updateAreaDims(){ let contentAreaEl = contentAreaRef.value!; diff --git a/src/components/BaseLine.vue b/src/components/BaseLine.vue index 7dd5253..3f36849 100644 --- a/src/components/BaseLine.vue +++ b/src/components/BaseLine.vue @@ -1,6 +1,6 @@