Working version
This commit is contained in:
parent
895baf48d5
commit
3e91e23ed5
3 changed files with 1 additions and 10 deletions
|
@ -88,9 +88,6 @@ Defs.prototype.set = function (name, value) {
|
||||||
* @return {Defs} this - The Defs instance
|
* @return {Defs} this - The Defs instance
|
||||||
*/
|
*/
|
||||||
Defs.prototype.setIfUnset = function (name, value) {
|
Defs.prototype.setIfUnset = function (name, value) {
|
||||||
// console.log({defsSetIfUnset:{name:name,value:value}})
|
|
||||||
if (typeof this.list[name] === 'undefined') this.list[name] = [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
|
return this
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@ export function Svg(pattern) {
|
||||||
* @return {string} svg - The rendered SVG output
|
* @return {string} svg - The rendered SVG output
|
||||||
*/
|
*/
|
||||||
Svg.prototype.render = function () {
|
Svg.prototype.render = function () {
|
||||||
// console.log('render')
|
|
||||||
|
|
||||||
this.idPrefix = this.pattern?.settings?.[0]?.idPrefix || 'fs-'
|
this.idPrefix = this.pattern?.settings?.[0]?.idPrefix || 'fs-'
|
||||||
this.__runHooks('preRender')
|
this.__runHooks('preRender')
|
||||||
if (!this.pattern.settings[0].embed) {
|
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
|
* @return {string} svg - The SVG markup for the defs block
|
||||||
*/
|
*/
|
||||||
Svg.prototype.__renderDefs = function () {
|
Svg.prototype.__renderDefs = function () {
|
||||||
console.log('__renderDefs')
|
|
||||||
let svg = '<defs>'
|
let svg = '<defs>'
|
||||||
this.__indent()
|
this.__indent()
|
||||||
// console.log({defs:this.defs.render()})
|
|
||||||
svg += this.__nl() + this.defs.render()
|
svg += this.__nl() + this.defs.render()
|
||||||
this.__outdent()
|
this.__outdent()
|
||||||
svg += this.__nl() + '</defs>' + this.__nl()
|
svg += this.__nl() + '</defs>' + this.__nl()
|
||||||
|
@ -234,7 +230,6 @@ Svg.prototype.__renderDefs = function () {
|
||||||
* @return {string} svg - The SVG markup for the head section
|
* @return {string} svg - The SVG markup for the head section
|
||||||
*/
|
*/
|
||||||
Svg.prototype.__renderHead = function () {
|
Svg.prototype.__renderHead = function () {
|
||||||
// console.log('__renderHead')
|
|
||||||
let svg = this.__renderStyle()
|
let svg = this.__renderStyle()
|
||||||
svg += this.__renderDefs()
|
svg += this.__renderDefs()
|
||||||
svg += this.__openGroup(this.idPrefix + 'container')
|
svg += this.__openGroup(this.idPrefix + 'container')
|
||||||
|
@ -296,7 +291,6 @@ Svg.prototype.__renderPart = function (part) {
|
||||||
`${this.idPrefix}stack-${this.activeStack}-part-${part.name}`,
|
`${this.idPrefix}stack-${this.activeStack}-part-${part.name}`,
|
||||||
part.attributes
|
part.attributes
|
||||||
)
|
)
|
||||||
svg += this.__openGroup(`${this.idPrefix}stack-${this.activeStack}-part-${part.name}`, part.defs)
|
|
||||||
for (let key in part.paths) {
|
for (let key in part.paths) {
|
||||||
let path = part.paths[key]
|
let path = part.paths[key]
|
||||||
if (!path.hidden) svg += this.__renderPath(path)
|
if (!path.hidden) svg += this.__renderPath(path)
|
||||||
|
|
|
@ -49,7 +49,7 @@ const grids = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Defs = (props) => {
|
export const Defs = (props) => {
|
||||||
let defs = props.svg.defs
|
let defs = props.svg.defs.render()
|
||||||
if (props.settings[0].paperless) {
|
if (props.settings[0].paperless) {
|
||||||
defs += grids[props.settings[0].units || 'metric']
|
defs += grids[props.settings[0].units || 'metric']
|
||||||
for (let p in props.parts[0]) {
|
for (let p in props.parts[0]) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue