From 1cd86dfeeb346f21d61689b5895838197819bcf2 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Tue, 28 Sep 2021 15:58:32 +0200 Subject: [PATCH] Update paint.js --- src/editor/components/jgraduate/paint.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/editor/components/jgraduate/paint.js b/src/editor/components/jgraduate/paint.js index a82390bb..7a7fe3b7 100644 --- a/src/editor/components/jgraduate/paint.js +++ b/src/editor/components/jgraduate/paint.js @@ -56,13 +56,23 @@ export default class Paint { this.type = 'linearGradient'; this.solidColor = null; this.radialGradient = null; - this.linearGradient = options.linearGradient.cloneNode(true); + if(options.linearGradient.hasAttribute('xlink:href')) { + const xhref = document.getElementById(options.linearGradient.getAttribute('xlink:href').substr(1)); + this.linearGradient = xhref.cloneNode(true); + } else { + this.linearGradient = options.linearGradient.cloneNode(true); + } // create linear gradient paint } else if (options.radialGradient) { this.type = 'radialGradient'; this.solidColor = null; this.linearGradient = null; - this.radialGradient = options.radialGradient.cloneNode(true); + if(options.radialGradient.hasAttribute('xlink:href')) { + const xhref = document.getElementById(options.radialGradient.getAttribute('xlink:href').substr(1)); + this.radialGradient = xhref.cloneNode(true); + } else { + this.radialGradient = options.radialGradient.cloneNode(true); + } // create solid color paint } else if (options.solidColor) { this.type = 'solidColor'; @@ -75,4 +85,4 @@ export default class Paint { this.radialGradient = null; } } -} +} \ No newline at end of file