From f7075b27a1ac270aaca31215c38330eb255b4fe3 Mon Sep 17 00:00:00 2001 From: jingrow Date: Thu, 22 Jan 2026 13:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=83=8C=E6=99=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E5=A4=8D=E5=BA=94=E7=94=A8=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E5=90=8E=E6=97=A0=E6=B3=95=E5=BA=94=E7=94=A8=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E9=A2=9C=E8=89=B2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/tools/add_background/add_background.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/views/tools/add_background/add_background.vue b/src/views/tools/add_background/add_background.vue index e307185..0bce21d 100644 --- a/src/views/tools/add_background/add_background.vue +++ b/src/views/tools/add_background/add_background.vue @@ -1943,6 +1943,20 @@ const applyBackgroundSilent = async () => { const objects = fabricCanvas.getObjects() if (objects.length === 0) return + // If there are multiple objects (background image exists), keep only the last one (foreground) + // This ensures we remove any background images before applying color + if (objects.length > 1) { + // Disable auto-rendering to prevent multiple redraws + fabricCanvas.renderOnAddRemove = false + + // Remove all objects except the last one (foreground image) + const objectsToRemove = objects.slice(0, -1) + objectsToRemove.forEach(obj => fabricCanvas.remove(obj)) + + // Re-enable auto-rendering + fabricCanvas.renderOnAddRemove = true + } + // Set background color using fabric v7 API fabricCanvas.backgroundColor = backgroundColor.value fabricCanvas.renderAll()