-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.vue
More file actions
51 lines (44 loc) · 1.11 KB
/
index.vue
File metadata and controls
51 lines (44 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<div id="graph" ref="shellRef">
<Graph
:data="graphData"
:width="graphWidth"
:height="graphHeight"
:key="graphKey"
v-model="fullUpdateState"
/>
</div>
</template>
<script setup lang="ts">
import Graph from "./graph.vue";
import { computed, onMounted, ref } from "vue";
import { throttle } from "lodash-es";
import { useProfile } from "@/states";
const graphWidth = ref(0),
graphHeight = ref(0);
const graphKey = ref(0);
const fullUpdateState = ref(false);
const shellRef = ref<HTMLDivElement>();
onMounted(() => {
const observer = new ResizeObserver(
throttle(() => {
graphWidth.value = shellRef.value!.clientWidth;
graphHeight.value = shellRef.value!.clientHeight;
}, 180)
);
observer.observe(shellRef.value!);
});
const profile = useProfile();
const graphData = computed(() => {
void profile.data;
return profile.getOriginalCopy();
});
import emitter from "@/mitt";
emitter.on("require-full-update", () => {
fullUpdateState.value = true;
graphKey.value++;
});
emitter.on("require-post-update", () => {
graphKey.value++;
});
</script>