wip(core): Changes to support settings.scale. See #1638
This commit is contained in:
parent
3bf0f6f68b
commit
bb8a3a960e
3 changed files with 5 additions and 2 deletions
|
@ -182,6 +182,7 @@ Part.prototype.shorthand = function () {
|
||||||
let sa = this.context.settings.complete ? this.context.settings.sa || 0 : 0
|
let sa = this.context.settings.complete ? this.context.settings.sa || 0 : 0
|
||||||
const shorthand = {
|
const shorthand = {
|
||||||
sa,
|
sa,
|
||||||
|
scale: this.context.settings.scale,
|
||||||
store: this.context.store,
|
store: this.context.store,
|
||||||
macro: this.macroClosure(),
|
macro: this.macroClosure(),
|
||||||
units: this.unitsClosure(),
|
units: this.unitsClosure(),
|
||||||
|
|
|
@ -58,6 +58,7 @@ export default function Pattern(config = { options: {} }) {
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
units: 'metric',
|
units: 'metric',
|
||||||
margin: 2,
|
margin: 2,
|
||||||
|
scale: 1,
|
||||||
layout: true,
|
layout: true,
|
||||||
debug: true,
|
debug: true,
|
||||||
scale: 1,
|
scale: 1,
|
||||||
|
|
|
@ -204,7 +204,7 @@ Svg.prototype.renderText = function (point) {
|
||||||
}
|
}
|
||||||
point.attributes.set('data-text-x', round(point.x))
|
point.attributes.set('data-text-x', round(point.x))
|
||||||
point.attributes.set('data-text-y', round(point.y))
|
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')
|
point.attributes.remove('data-text-lineheight')
|
||||||
let svg = `${this.nl()}<text ${point.attributes.renderIfPrefixIs('data-text-')}>`
|
let svg = `${this.nl()}<text ${point.attributes.renderIfPrefixIs('data-text-')}>`
|
||||||
this.indent()
|
this.indent()
|
||||||
|
@ -238,7 +238,8 @@ Svg.prototype.renderCircle = function (point) {
|
||||||
Svg.prototype.renderSnippet = function (snippet, part) {
|
Svg.prototype.renderSnippet = function (snippet, part) {
|
||||||
let x = round(snippet.anchor.x)
|
let x = round(snippet.anchor.x)
|
||||||
let y = round(snippet.anchor.y)
|
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) {
|
if (scale) {
|
||||||
snippet.attributes.add('transform', `translate(${x}, ${y})`)
|
snippet.attributes.add('transform', `translate(${x}, ${y})`)
|
||||||
snippet.attributes.add('transform', `scale(${scale})`)
|
snippet.attributes.add('transform', `scale(${scale})`)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue