From d1036e130c3a0f235659d3a0e68d7fc7137a8a66 Mon Sep 17 00:00:00 2001
From: Andrea Gottsponer <ago@attr.ch>
Date: Wed, 14 Sep 2022 01:40:04 +0200
Subject: [PATCH] - fix fill color problem

---
 src/app/index.ts                         | 7 +++++--
 src/lib/elements/fills/FillCollection.ts | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/app/index.ts b/src/app/index.ts
index 55ec1e90..ee1ea091 100644
--- a/src/app/index.ts
+++ b/src/app/index.ts
@@ -909,6 +909,7 @@ async function setupImageObjects() {
         }
     });
     image.addChild(fill1);
+    elementsArray['fill1'] = fill1;
     // -- FillLine
     const fillLine = new MedsurfDraw.Line({
         id: 'fillLine',
@@ -1426,6 +1427,8 @@ buttonVirtualPointer.addEventListener("click", () => {
     virtualPointer.visible = !virtualPointer.visible;
 });
 buttonTest.addEventListener("click", () => {
+    (elementsArray['fill1'] as MedsurfDraw.FillCollection).onColor(MedsurfDraw.ColorMode.FILL, true, 0x123456, 0.6);
+
     /* Text add middle point button * /
     line1.onButtonAddMiddlePoint(image);
     line2.onButtonAddMiddlePoint(image);
@@ -1618,7 +1621,7 @@ buttonTest.addEventListener("click", () => {
     });
     /**/
     // Select item
-    /**/
+    /** /
      const generator = new MedsurfDraw.SelectItemGenerator({
             target: image,
             element: elementsArray['textPoint'] as MedsurfDraw.PositionPoint,
@@ -1649,7 +1652,7 @@ buttonTest.addEventListener("click", () => {
                     });
      /**/
 
-    /**/
+    /** /
     // Default
     // generator.once('startGenerator', _startGenerator, this); // NOT FOR CLONING; TODO layerGroup testing
     generator.once('endGenerator', generator.endGenerator, generator);
diff --git a/src/lib/elements/fills/FillCollection.ts b/src/lib/elements/fills/FillCollection.ts
index 5ab93644..d1f178a1 100644
--- a/src/lib/elements/fills/FillCollection.ts
+++ b/src/lib/elements/fills/FillCollection.ts
@@ -1502,6 +1502,9 @@ export class FillCollection extends BaseElementContainer<Models.FillCollection,
             this.model.options.fillColor = color;
             this.model.options.fillAlpha = colorAlpha;
 
+            // Element
+            this.options = Object.assign({}, this.model.options);
+
             // Draw
             this.emit("debounceDraw");
 
-- 
GitLab