From ad613d06d48d4a828036cc9966a7ec054496e770 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Mon, 22 Aug 2022 00:39:59 -0500 Subject: [PATCH] Fixed fonts causing shifts in Node positions on firefox --- src/components/Context.vue | 5 +++-- src/features/particles/Particles.vue | 8 ++++---- src/game/events.ts | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/Context.vue b/src/components/Context.vue index 21ded12..d752460 100644 --- a/src/components/Context.vue +++ b/src/components/Context.vue @@ -12,6 +12,7 @@ import { } from "game/layers"; import type { FeatureNode } from "game/layers"; import { nextTick, onMounted, provide, ref } from "vue"; +import { globalBus } from "game/events"; const emit = defineEmits<{ (e: "updateNodes", nodes: Record): void; @@ -31,7 +32,7 @@ onMounted(() => { let isDirty = true; let boundingRect = ref(resizeListener.value?.getBoundingClientRect()); function updateBounds() { - if (resizeListener.value != null && isDirty) { + if (isDirty) { isDirty = false; nextTick(() => { boundingRect.value = resizeListener.value?.getBoundingClientRect(); @@ -43,7 +44,7 @@ function updateBounds() { }); } } -document.fonts.ready.then(updateBounds); +globalBus.on("fontsLoaded", updateBounds); const observerOptions = { attributes: false, diff --git a/src/features/particles/Particles.vue b/src/features/particles/Particles.vue index 8a3dd2d..1f7de78 100644 --- a/src/features/particles/Particles.vue +++ b/src/features/particles/Particles.vue @@ -10,6 +10,7 @@