From fce7a0ec72e1ddd33f04dab85c329677350cc2b5 Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Tue, 18 Nov 2025 01:37:09 +0800 Subject: [PATCH] feat: add background color picker and update related functionality in DesignerToolbar --- app/components/designer/DesignerToolbar.vue | 26 +++++++++++++++++++++ app/pages/index.vue | 3 +++ composables/useSlipmatDesigner.ts | 15 ++++++++++++ 3 files changed, 44 insertions(+) diff --git a/app/components/designer/DesignerToolbar.vue b/app/components/designer/DesignerToolbar.vue index 4217144..ba39e76 100644 --- a/app/components/designer/DesignerToolbar.vue +++ b/app/components/designer/DesignerToolbar.vue @@ -9,8 +9,10 @@ const props = defineProps<{ onImportImage: (file: File) => Promise; onFillChange: (fill: string) => void; onStrokeChange: (stroke: string) => void; + onBackgroundChange: (background: string) => void; activeFill: string | null; activeStroke: string | null; + activeBackground: string; canStyleSelection: boolean; zoom: number; minZoom: number; @@ -28,6 +30,7 @@ const emit = defineEmits<{ const fileInput = ref(null); const fillValue = ref(props.activeFill ?? "#111827"); const strokeValue = ref(props.activeStroke ?? "#3b82f6"); +const backgroundValue = ref(props.activeBackground ?? "#ffffff"); const zoomSliderValue = ref(Math.round(props.zoom * 100)); watch( @@ -44,6 +47,13 @@ watch( } ); +watch( + () => props.activeBackground, + (next) => { + backgroundValue.value = next ?? "#ffffff"; + } +); + watch( () => props.zoom, (next) => { @@ -88,6 +98,13 @@ const handleStrokeChange = (event: Event) => { props.onStrokeChange(value); }; +const handleBackgroundChange = (event: Event) => { + const input = event.target as HTMLInputElement; + const value = input.value; + backgroundValue.value = value; + props.onBackgroundChange(value); +}; + const handleZoomInput = (event: Event) => { const input = event.target as HTMLInputElement; const value = Number(input.value); @@ -141,6 +158,15 @@ const zoomLabel = computed(() => `${Math.round(props.zoom * 100)}%`);
+