From f60fb3625c244d3f7e61d66385fd3f1bc879b1e5 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Mon, 29 Dec 2025 21:01:19 +0100 Subject: [PATCH] feat: centralize all screen related callbacks in useScreen --- app/components/Common/Bars.vue | 4 +- app/components/Common/ButtonSelector.vue | 4 +- app/components/Common/Buttons.vue | 10 ++-- app/components/Common/ConfirmationModal.vue | 6 ++- .../Contact/BottomScreen/Background.vue | 5 +- .../Contact/BottomScreen/Buttons.vue | 5 +- .../Contact/TopScreen/Background.vue | 5 +- app/components/Contact/TopScreen/LeftBar.vue | 5 +- .../Contact/TopScreen/Notifications.vue | 5 +- .../Home/BottomScreen/Background.vue | 5 +- app/components/Home/BottomScreen/Button.vue | 4 +- app/components/Home/BottomScreen/Buttons.vue | 4 +- app/components/Home/TopScreen/Background.vue | 5 +- app/components/Home/TopScreen/Calendar.vue | 5 +- app/components/Home/TopScreen/Clock.vue | 9 ++-- app/components/Home/TopScreen/StatusBar.vue | 5 +- .../Projects/BottomScreen/Background.vue | 4 +- .../Projects/BottomScreen/Buttons.vue | 7 +-- .../BottomScreen/LinkConfirmationPopup.vue | 6 ++- .../Projects/TopScreen/Background.vue | 4 +- app/components/Projects/TopScreen/Project.vue | 5 +- app/components/Screen.vue | 12 +++-- .../Settings/BottomScreen/Background.vue | 4 +- .../BottomScreen/Menus/Clock/Menu.vue | 4 +- .../BottomScreen/Menus/Options/GbaMode.vue | 4 +- .../BottomScreen/Menus/Options/Language.vue | 4 +- .../BottomScreen/Menus/Options/Menu.vue | 4 +- .../BottomScreen/Menus/Options/StartUp.vue | 4 +- .../BottomScreen/Menus/TouchScreen/Menu.vue | 4 +- .../BottomScreen/Menus/User/Color.vue | 15 +++--- .../Settings/BottomScreen/Menus/User/Menu.vue | 4 +- .../Settings/TopScreen/Background.vue | 4 +- .../Settings/TopScreen/Calendar.vue | 4 +- app/components/Settings/TopScreen/Clock.vue | 8 +-- .../Settings/TopScreen/Notifications.vue | 5 +- .../Settings/TopScreen/StatusBar.vue | 4 +- app/components/Stats.vue | 4 +- app/composables/useButtonNavigation.ts | 4 +- app/composables/useRender.ts | 22 -------- app/composables/useScreen.ts | 50 +++++++++++++++++++ app/composables/useScreenClick.ts | 18 ------- app/composables/useScreenMouseWheel.ts | 18 ------- 42 files changed, 184 insertions(+), 128 deletions(-) delete mode 100644 app/composables/useRender.ts create mode 100644 app/composables/useScreen.ts delete mode 100644 app/composables/useScreenClick.ts delete mode 100644 app/composables/useScreenMouseWheel.ts diff --git a/app/components/Common/Bars.vue b/app/components/Common/Bars.vue index e8e5925..361f83d 100644 --- a/app/components/Common/Bars.vue +++ b/app/components/Common/Bars.vue @@ -12,6 +12,8 @@ const props = withDefaults( }, ); +const { onRender } = useScreen(); + const app = useAppStore(); const { assets } = useAssets(); @@ -19,7 +21,7 @@ const BAR_WIDTH = 256; const BAR_HEIGHT = 24; const TITLE_Y = 5; -useRender((ctx) => { +onRender((ctx) => { ctx.globalAlpha = props.opacity; // top bar diff --git a/app/components/Common/ButtonSelector.vue b/app/components/Common/ButtonSelector.vue index d7e4422..08d445f 100644 --- a/app/components/Common/ButtonSelector.vue +++ b/app/components/Common/ButtonSelector.vue @@ -9,6 +9,8 @@ const props = withDefaults( }, ); +const { onRender } = useScreen(); + const app = useAppStore(); const { assets } = useAssets(); @@ -17,7 +19,7 @@ const CORNER_SIZE = 11; let [currentX, currentY, currentWidth, currentHeight] = props.rect; -useRender((ctx) => { +onRender((ctx) => { const [targetX, targetY, targetWidth, targetHeight] = props.rect; const dx = targetX - currentX; const dy = targetY - currentY; diff --git a/app/components/Common/Buttons.vue b/app/components/Common/Buttons.vue index 09faa45..5c7d4e8 100644 --- a/app/components/Common/Buttons.vue +++ b/app/components/Common/Buttons.vue @@ -1,6 +1,4 @@