diff --git a/packages/core/src/part.js b/packages/core/src/part.js index 06114d49930..27047d42c5d 100644 --- a/packages/core/src/part.js +++ b/packages/core/src/part.js @@ -182,6 +182,7 @@ Part.prototype.shorthand = function () { let sa = this.context.settings.complete ? this.context.settings.sa || 0 : 0 const shorthand = { sa, + scale: this.context.settings.scale, store: this.context.store, macro: this.macroClosure(), units: this.unitsClosure(), diff --git a/packages/core/src/pattern.js b/packages/core/src/pattern.js index 76467010727..6c5f7873d2e 100644 --- a/packages/core/src/pattern.js +++ b/packages/core/src/pattern.js @@ -58,6 +58,7 @@ export default function Pattern(config = { options: {} }) { locale: 'en', units: 'metric', margin: 2, + scale: 1, layout: true, debug: true, scale: 1, diff --git a/packages/core/src/svg.js b/packages/core/src/svg.js index f8f46301a23..662fb70a153 100644 --- a/packages/core/src/svg.js +++ b/packages/core/src/svg.js @@ -204,7 +204,7 @@ Svg.prototype.renderText = function (point) { } point.attributes.set('data-text-x', round(point.x)) point.attributes.set('data-text-y', round(point.y)) - let lineHeight = point.attributes.get('data-text-lineheight') || 12 + let lineHeight = point.attributes.get('data-text-lineheight') || (6 * (this.pattern.settings.scale || 1)) point.attributes.remove('data-text-lineheight') let svg = `${this.nl()}` this.indent() @@ -238,7 +238,8 @@ Svg.prototype.renderCircle = function (point) { Svg.prototype.renderSnippet = function (snippet, part) { let x = round(snippet.anchor.x) let y = round(snippet.anchor.y) - let scale = snippet.attributes.get('data-scale') + let scale = snippet.attributes.get('data-scale') || 1 + scale = scale * (this.pattern.settings.scale || 1) if (scale) { snippet.attributes.add('transform', `translate(${x}, ${y})`) snippet.attributes.add('transform', `scale(${scale})`)