chore(core): cleanup and replace const with function

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-07 12:27:41 +01:00
committed by Braks
parent 5abe4ca2e5
commit bb2c4f449a
16 changed files with 183 additions and 164 deletions
@@ -18,7 +18,13 @@ let box = $ref<RectType>({ x: 0, y: 0, width: 0, height: 0 })
const el = $ref<SVGTextElement | null>(null)
const getBox = () => {
const transform = computed(() => `translate(${x - box.width / 2} ${y - box.height / 2})`)
onMounted(getBox)
watch([() => x, () => y, $$(el), () => label], getBox)
function getBox() {
if (!el) return
const nextBox = el.getBBox()
@@ -27,12 +33,6 @@ const getBox = () => {
box = nextBox
}
}
onMounted(getBox)
watch([() => x, () => y, $$(el), () => label], getBox)
const transform = computed(() => `translate(${x - box.width / 2} ${y - box.height / 2})`)
</script>
<script lang="ts">