From 3e91e23ed5e338221b68e93facb974ae638f98ee Mon Sep 17 00:00:00 2001 From: Wouter van Wageningen Date: Thu, 20 Apr 2023 05:44:39 +0000 Subject: [PATCH] Working version --- packages/core/src/defs.mjs | 3 --- packages/core/src/svg.mjs | 6 ------ sites/shared/components/workbench/draft/defs.mjs | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/core/src/defs.mjs b/packages/core/src/defs.mjs index 7cd5c5e28d6..9fc13d25b31 100644 --- a/packages/core/src/defs.mjs +++ b/packages/core/src/defs.mjs @@ -88,9 +88,6 @@ Defs.prototype.set = function (name, value) { * @return {Defs} this - The Defs instance */ Defs.prototype.setIfUnset = function (name, value) { - // console.log({defsSetIfUnset:{name:name,value:value}}) if (typeof this.list[name] === 'undefined') this.list[name] = [value] - // console.log({list:JSON.parse(JSON.stringify(this.list))}) - // console.log({defs:this.render()}) return this } diff --git a/packages/core/src/svg.mjs b/packages/core/src/svg.mjs index f2f8f2f530f..0dd58f963ea 100644 --- a/packages/core/src/svg.mjs +++ b/packages/core/src/svg.mjs @@ -46,8 +46,6 @@ export function Svg(pattern) { * @return {string} svg - The rendered SVG output */ Svg.prototype.render = function () { - // console.log('render') - this.idPrefix = this.pattern?.settings?.[0]?.idPrefix || 'fs-' this.__runHooks('preRender') if (!this.pattern.settings[0].embed) { @@ -216,10 +214,8 @@ Svg.prototype.__renderCircle = function (point) { * @return {string} svg - The SVG markup for the defs block */ Svg.prototype.__renderDefs = function () { - console.log('__renderDefs') let svg = '' this.__indent() - // console.log({defs:this.defs.render()}) svg += this.__nl() + this.defs.render() this.__outdent() svg += this.__nl() + '' + this.__nl() @@ -234,7 +230,6 @@ Svg.prototype.__renderDefs = function () { * @return {string} svg - The SVG markup for the head section */ Svg.prototype.__renderHead = function () { - // console.log('__renderHead') let svg = this.__renderStyle() svg += this.__renderDefs() svg += this.__openGroup(this.idPrefix + 'container') @@ -296,7 +291,6 @@ Svg.prototype.__renderPart = function (part) { `${this.idPrefix}stack-${this.activeStack}-part-${part.name}`, part.attributes ) - svg += this.__openGroup(`${this.idPrefix}stack-${this.activeStack}-part-${part.name}`, part.defs) for (let key in part.paths) { let path = part.paths[key] if (!path.hidden) svg += this.__renderPath(path) diff --git a/sites/shared/components/workbench/draft/defs.mjs b/sites/shared/components/workbench/draft/defs.mjs index 07cb9ab5173..92b25ee379a 100644 --- a/sites/shared/components/workbench/draft/defs.mjs +++ b/sites/shared/components/workbench/draft/defs.mjs @@ -49,7 +49,7 @@ const grids = { } export const Defs = (props) => { - let defs = props.svg.defs + let defs = props.svg.defs.render() if (props.settings[0].paperless) { defs += grids[props.settings[0].units || 'metric'] for (let p in props.parts[0]) {