svg tweak
This commit is contained in:
parent
cbcbbeb5b8
commit
27ee9139a6
2 changed files with 2 additions and 16 deletions
|
@ -24,12 +24,6 @@ export const scaleboxMacros = {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const transform = function (anchor) {
|
|
||||||
return `translate(${anchor.x}, ${anchor.y}) scale(${scale}) translate(${anchor.x * -1}, ${
|
|
||||||
anchor.y * -1
|
|
||||||
})`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert scale to a value between 0 and 9, inclusive.
|
// Convert scale to a value between 0 and 9, inclusive.
|
||||||
const scaleIndex = Math.round(10 * Math.max(0.1, Math.min(1, scale))) - 1
|
const scaleIndex = Math.round(10 * Math.max(0.1, Math.min(1, scale))) - 1
|
||||||
|
|
||||||
|
@ -159,7 +153,6 @@ export const scaleboxMacros = {
|
||||||
points.__scaleboxLead
|
points.__scaleboxLead
|
||||||
.attr('data-text', so.lead || 'FreeSewing')
|
.attr('data-text', so.lead || 'FreeSewing')
|
||||||
.attr('data-text-class', 'text-sm')
|
.attr('data-text-class', 'text-sm')
|
||||||
.attr('data-text-transform', transform(points.__scaleboxLead))
|
|
||||||
// Title
|
// Title
|
||||||
if (so.title) points.__scaleboxTitle.attributes.set('data-text', so.title)
|
if (so.title) points.__scaleboxTitle.attributes.set('data-text', so.title)
|
||||||
else {
|
else {
|
||||||
|
@ -169,7 +162,6 @@ export const scaleboxMacros = {
|
||||||
.attr('data-text', name)
|
.attr('data-text', name)
|
||||||
.attr('data-text', 'v' + (store.data?.version || 'No Version'))
|
.attr('data-text', 'v' + (store.data?.version || 'No Version'))
|
||||||
}
|
}
|
||||||
points.__scaleboxTitle.attr('data-text-transform', transform(points.__scaleboxTitle))
|
|
||||||
points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
||||||
// Text
|
// Text
|
||||||
if (typeof so.text === 'string') {
|
if (typeof so.text === 'string') {
|
||||||
|
@ -180,11 +172,7 @@ export const scaleboxMacros = {
|
||||||
.attr('data-text', 'freesewing.org/patrons/join')
|
.attr('data-text', 'freesewing.org/patrons/join')
|
||||||
.attr('data-text-class', 'text-sm fill-note')
|
.attr('data-text-class', 'text-sm fill-note')
|
||||||
}
|
}
|
||||||
points.__scaleboxLink.attr('data-text-transform', transform(points.__scaleboxLink))
|
points.__scaleboxText.attr('data-text-class', 'text-xs').attr('data-text-lineheight', 4)
|
||||||
points.__scaleboxText
|
|
||||||
.attr('data-text-transform', transform(points.__scaleboxText))
|
|
||||||
.attr('data-text-class', 'text-xs')
|
|
||||||
.attr('data-text-lineheight', 4)
|
|
||||||
// Instructions
|
// Instructions
|
||||||
points.__scaleboxMetric = points.__scaleboxMetric
|
points.__scaleboxMetric = points.__scaleboxMetric
|
||||||
.attr('data-text', 'theWhiteInsideOfThisBoxShouldMeasure')
|
.attr('data-text', 'theWhiteInsideOfThisBoxShouldMeasure')
|
||||||
|
@ -192,14 +180,12 @@ export const scaleboxMacros = {
|
||||||
.attr('data-text', 'x')
|
.attr('data-text', 'x')
|
||||||
.attr('data-text', `${metricDisplayHeight}`)
|
.attr('data-text', `${metricDisplayHeight}`)
|
||||||
.attr('data-text-class', 'text-xs center')
|
.attr('data-text-class', 'text-xs center')
|
||||||
.attr('data-text-transform', transform(points.__scaleboxMetric))
|
|
||||||
points.__scaleboxImperial = points.__scaleboxImperial
|
points.__scaleboxImperial = points.__scaleboxImperial
|
||||||
.attr('data-text', 'theBlackOutsideOfThisBoxShouldMeasure')
|
.attr('data-text', 'theBlackOutsideOfThisBoxShouldMeasure')
|
||||||
.attr('data-text', `${imperialDisplayWidth}`)
|
.attr('data-text', `${imperialDisplayWidth}`)
|
||||||
.attr('data-text', 'x')
|
.attr('data-text', 'x')
|
||||||
.attr('data-text', `${imperialDisplayHeight}`)
|
.attr('data-text', `${imperialDisplayHeight}`)
|
||||||
.attr('data-text-class', 'text-xs center ')
|
.attr('data-text-class', 'text-xs center ')
|
||||||
.attr('data-text-transform', transform(points.__scaleboxImperial))
|
|
||||||
},
|
},
|
||||||
miniscale(so, { points, paths, scale, Point, Path }) {
|
miniscale(so, { points, paths, scale, Point, Path }) {
|
||||||
// Passing `false` will remove the miniscale
|
// Passing `false` will remove the miniscale
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const plugin = {
|
||||||
svg.attributes.set('class', 'freesewing')
|
svg.attributes.set('class', 'freesewing')
|
||||||
svg.style += sampleStyle(data.stripped)
|
svg.style += sampleStyle(data.stripped)
|
||||||
svg.style += paperlessStyle(data.stripped)
|
svg.style += paperlessStyle(data.stripped)
|
||||||
svg.style += buildStylesheet(svg.pattern.settings.scale, data.stripped)
|
svg.style += buildStylesheet(svg.pattern.settings[0].scale, data.stripped)
|
||||||
let paperless = false
|
let paperless = false
|
||||||
for (const set of svg.pattern.settings) {
|
for (const set of svg.pattern.settings) {
|
||||||
if (set.paperless) paperless = true
|
if (set.paperless) paperless = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue