diff --git a/plugins/plugin-annotations/src/bartack.mjs b/plugins/plugin-annotations/src/bartack.mjs index 08348779166..19d7df7276f 100644 --- a/plugins/plugin-annotations/src/bartack.mjs +++ b/plugins/plugin-annotations/src/bartack.mjs @@ -58,7 +58,9 @@ function createBartack(so, props) { } so = { ...defaults, ...so } - const { Path, paths } = props + const { Path, paths, scale } = props + + so.width *= scale // Handle negative angle if (so.angle < 0) so.angle = 360 + (so.angle % -360) diff --git a/plugins/plugin-annotations/src/buttons.mjs b/plugins/plugin-annotations/src/buttons.mjs index cf870fbdd4d..ac16062a8ce 100644 --- a/plugins/plugin-annotations/src/buttons.mjs +++ b/plugins/plugin-annotations/src/buttons.mjs @@ -2,8 +2,9 @@ export const buttonsDefs = [ { name: 'button', - def: ` - + def: (scale) => ` + + def: (scale) => ` + + def: (scale) => ` + + def: (scale) => ` + + def: (scale) => ` + `, }, { name: 'snap-stud', - def: ` - + def: (scale) => ` + @@ -70,8 +76,9 @@ export const buttonsDefs = [ }, { name: 'snap-socket', - def: ` - + def: (scale) => ` + diff --git a/plugins/plugin-annotations/src/cutonfold.mjs b/plugins/plugin-annotations/src/cutonfold.mjs index 17f2ca08c77..99461367e3a 100644 --- a/plugins/plugin-annotations/src/cutonfold.mjs +++ b/plugins/plugin-annotations/src/cutonfold.mjs @@ -2,16 +2,16 @@ export const cutonfoldDefs = [ { name: 'cutonfoldFrom', - def: ` - - + def: (scale) => ` + + `, }, { name: 'cutonfoldTo', - def: ` - - + def: (scale) => ` + + `, }, ] diff --git a/plugins/plugin-annotations/src/dimensions.mjs b/plugins/plugin-annotations/src/dimensions.mjs index a4facf35b46..b26318bb8d9 100644 --- a/plugins/plugin-annotations/src/dimensions.mjs +++ b/plugins/plugin-annotations/src/dimensions.mjs @@ -2,16 +2,16 @@ export const dimensionsDefs = [ { name: 'dimensionFrom', - def: ` - - + def: (scale) => ` + + `, }, { name: 'dimensionTo', - def: ` - - + def: (scale) => ` + + `, }, ] diff --git a/plugins/plugin-annotations/src/grainline.mjs b/plugins/plugin-annotations/src/grainline.mjs index be4c57024ee..454e29da2bc 100644 --- a/plugins/plugin-annotations/src/grainline.mjs +++ b/plugins/plugin-annotations/src/grainline.mjs @@ -2,16 +2,16 @@ export const grainlineDefs = [ { name: 'grainlineFrom', - def: ` - - + def: (scale) => ` + + `, }, { name: 'grainlineTo', - def: ` - - + def: (scale) => ` + + `, }, ] diff --git a/plugins/plugin-annotations/src/notches.mjs b/plugins/plugin-annotations/src/notches.mjs index eccb5ed6fb7..0f20f170553 100644 --- a/plugins/plugin-annotations/src/notches.mjs +++ b/plugins/plugin-annotations/src/notches.mjs @@ -2,16 +2,16 @@ export const notchesDefs = [ { name: 'notch', - def: ` - + def: (scale) => ` + `, }, { name: 'bnotch', - def: ` - + def: (scale) => ` + `, diff --git a/plugins/plugin-annotations/src/pleat.mjs b/plugins/plugin-annotations/src/pleat.mjs index 3bc0f59c9ac..71d6105741f 100644 --- a/plugins/plugin-annotations/src/pleat.mjs +++ b/plugins/plugin-annotations/src/pleat.mjs @@ -1,10 +1,10 @@ // Export defs export const pleatDefs = [ { - name: 'notch', - def: ` - - + name: 'pleatTo', + def: (scale) => ` + + `, }, diff --git a/plugins/plugin-annotations/src/scalebox.mjs b/plugins/plugin-annotations/src/scalebox.mjs index 3c8278fd197..f8a1233add8 100644 --- a/plugins/plugin-annotations/src/scalebox.mjs +++ b/plugins/plugin-annotations/src/scalebox.mjs @@ -24,6 +24,12 @@ export const scaleboxMacros = { 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. const scaleIndex = Math.round(10 * Math.max(0.1, Math.min(1, scale))) - 1 @@ -99,7 +105,9 @@ export const scaleboxMacros = { so.at.y + imperialHeight / 2 ) // Text anchor points - points.__scaleboxLead = new Point(so.at.x - 45 * scale, so.at.y - 15 * scale) + points.__scaleboxLead = points.__scaleboxImperialTopLeft + .shift(-90, 7 * scale) + .shift(0, 2 * scale) points.__scaleboxTitle = points.__scaleboxLead.shift(-90, 10 * scale) points.__scaleboxText = points.__scaleboxTitle.shift(-90, 12 * scale) points.__scaleboxLink = points.__scaleboxText.shift(-90, 5 * scale) @@ -148,9 +156,10 @@ export const scaleboxMacros = { .line(points.__scaleboxMetricTopRight) .close() // Lead - points.__scaleboxLead = points.__scaleboxLead + points.__scaleboxLead .attr('data-text', so.lead || 'FreeSewing') .attr('data-text-class', 'text-sm') + .attr('data-text-transform', transform(points.__scaleboxLead)) // Title if (so.title) points.__scaleboxTitle.attributes.set('data-text', so.title) else { @@ -160,6 +169,7 @@ export const scaleboxMacros = { .attr('data-text', name) .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') // Text if (typeof so.text === 'string') { @@ -170,7 +180,11 @@ export const scaleboxMacros = { .attr('data-text', 'freesewing.org/patrons/join') .attr('data-text-class', 'text-sm fill-note') } - points.__scaleboxText.attr('data-text-class', 'text-xs').attr('data-text-lineheight', 4) + points.__scaleboxLink.attr('data-text-transform', transform(points.__scaleboxLink)) + points.__scaleboxText + .attr('data-text-transform', transform(points.__scaleboxText)) + .attr('data-text-class', 'text-xs') + .attr('data-text-lineheight', 4) // Instructions points.__scaleboxMetric = points.__scaleboxMetric .attr('data-text', 'theWhiteInsideOfThisBoxShouldMeasure') @@ -178,12 +192,14 @@ export const scaleboxMacros = { .attr('data-text', 'x') .attr('data-text', `${metricDisplayHeight}`) .attr('data-text-class', 'text-xs center') + .attr('data-text-transform', transform(points.__scaleboxMetric)) points.__scaleboxImperial = points.__scaleboxImperial .attr('data-text', 'theBlackOutsideOfThisBoxShouldMeasure') .attr('data-text', `${imperialDisplayWidth}`) .attr('data-text', 'x') .attr('data-text', `${imperialDisplayHeight}`) .attr('data-text-class', 'text-xs center ') + .attr('data-text-transform', transform(points.__scaleboxImperial)) }, miniscale(so, { points, paths, scale, Point, Path }) { // Passing `false` will remove the miniscale diff --git a/plugins/plugin-annotations/src/sewtogether.mjs b/plugins/plugin-annotations/src/sewtogether.mjs index 6884865e6a7..ae843816e6d 100644 --- a/plugins/plugin-annotations/src/sewtogether.mjs +++ b/plugins/plugin-annotations/src/sewtogether.mjs @@ -2,23 +2,23 @@ export const sewtogetherDefs = [ { name: 'sewTogetherStart', - def: ` - - + def: (scale) => ` + + `, }, { name: 'sewTogetherEnd', - def: ` - - + def: (scale) => ` + + `, }, { name: 'sewTogetherCross', - def: ` - - + def: (scale) => ` + + `, }, ] diff --git a/plugins/plugin-annotations/tests/scalebox.test.mjs b/plugins/plugin-annotations/tests/scalebox.test.mjs index c6fa82b3398..632d7f3d370 100644 --- a/plugins/plugin-annotations/tests/scalebox.test.mjs +++ b/plugins/plugin-annotations/tests/scalebox.test.mjs @@ -38,14 +38,14 @@ describe('Scalebox Plugin Tests', () => { expect(p.__scaleboxImperialBottomLeft.y).to.equal(225.4) expect(p.__scaleboxImperialBottomRight.x).to.equal(150.8) expect(p.__scaleboxImperialBottomRight.y).to.equal(225.4) - expect(p.__scaleboxLead.x).to.equal(55) - expect(p.__scaleboxLead.y).to.equal(185) - expect(p.__scaleboxTitle.x).to.equal(55) - expect(p.__scaleboxTitle.y).to.equal(195) - expect(p.__scaleboxText.x).to.equal(55) - expect(p.__scaleboxText.y).to.equal(207) - expect(p.__scaleboxLink.x).to.equal(55) - expect(p.__scaleboxLink.y).to.equal(212) + expect(p.__scaleboxLead.x).to.equal(51.2) + expect(p.__scaleboxLead.y).to.equal(181.6) + expect(p.__scaleboxTitle.x).to.equal(51.2) + expect(p.__scaleboxTitle.y).to.equal(191.6) + expect(p.__scaleboxText.x).to.equal(51.2) + expect(p.__scaleboxText.y).to.equal(203.6) + expect(p.__scaleboxLink.x).to.equal(51.2) + expect(p.__scaleboxLink.y).to.equal(208.6) expect(p.__scaleboxMetric.x).to.equal(100) expect(p.__scaleboxMetric.y).to.equal(220) expect(p.__scaleboxImperial.x).to.equal(100) @@ -112,14 +112,14 @@ describe('Scalebox Plugin Tests', () => { expect(round(p.__scaleboxImperialBottomLeft.y)).to.equal(250.8) expect(round(p.__scaleboxImperialBottomRight.x)).to.equal(125.4) expect(round(p.__scaleboxImperialBottomRight.y)).to.equal(149.2) - expect(round(p.__scaleboxLead.x)).to.equal(85) - expect(round(p.__scaleboxLead.y)).to.equal(245) - expect(round(p.__scaleboxTitle.x)).to.equal(95) - expect(round(p.__scaleboxTitle.y)).to.equal(245) - expect(round(p.__scaleboxText.x)).to.equal(107) - expect(round(p.__scaleboxText.y)).to.equal(245) - expect(round(p.__scaleboxLink.x)).to.equal(112) - expect(round(p.__scaleboxLink.y)).to.equal(245) + expect(round(p.__scaleboxLead.x)).to.equal(81.6) + expect(round(p.__scaleboxLead.y)).to.equal(248.8) + expect(round(p.__scaleboxTitle.x)).to.equal(91.6) + expect(round(p.__scaleboxTitle.y)).to.equal(248.8) + expect(round(p.__scaleboxText.x)).to.equal(103.6) + expect(round(p.__scaleboxText.y)).to.equal(248.8) + expect(round(p.__scaleboxLink.x)).to.equal(108.6) + expect(round(p.__scaleboxLink.y)).to.equal(248.8) expect(round(p.__scaleboxMetric.x)).to.equal(120) expect(round(p.__scaleboxMetric.y)).to.equal(200) expect(round(p.__scaleboxImperial.x)).to.equal(124) diff --git a/sites/shared/components/workbench/menu/core-settings/index.mjs b/sites/shared/components/workbench/menu/core-settings/index.mjs index aaf2be91183..232bb9691e6 100644 --- a/sites/shared/components/workbench/menu/core-settings/index.mjs +++ b/sites/shared/components/workbench/menu/core-settings/index.mjs @@ -33,7 +33,7 @@ export const settings = { }, scale: { min: 0.1, - max: 5, + max: 1, dflt: 1, }, renderer: { diff --git a/sites/shared/themes/hax0r.js b/sites/shared/themes/hax0r.js index 9705e4c99e4..dcfd477fcc2 100644 --- a/sites/shared/themes/hax0r.js +++ b/sites/shared/themes/hax0r.js @@ -106,7 +106,7 @@ module.exports = { '--pattern-text-3xl': '2rem', '--pattern-text-4xl': '3rem', - '--pattern-scale': '1', + // '--pattern-scale': '1', '--pattern-stroke-xs': '0.2px', '--pattern-stroke-sm': '0.4px', '--pattern-stroke': '0.7px', diff --git a/sites/shared/themes/lgbtq.js b/sites/shared/themes/lgbtq.js index 33997fb1e81..05786dafc64 100644 --- a/sites/shared/themes/lgbtq.js +++ b/sites/shared/themes/lgbtq.js @@ -109,7 +109,7 @@ module.exports = { '--pattern-text-3xl': '2rem', '--pattern-text-4xl': '3rem', - '--pattern-scale': '1', + // '--pattern-scale': '1', '--pattern-stroke-xs': '0.2px', '--pattern-stroke-sm': '0.4px', '--pattern-stroke': '0.7px', diff --git a/sites/shared/themes/light.js b/sites/shared/themes/light.js index d8903858c40..db50bde1906 100644 --- a/sites/shared/themes/light.js +++ b/sites/shared/themes/light.js @@ -241,7 +241,7 @@ module.exports = { '--pattern-text-4xl': '3rem', // Pattern overal scale for strokes and text sizes - '--pattern-scale': '1', + // '--pattern-scale': '1', // Pattern xs stroke width '--pattern-stroke-xs': '0.2px', // Pattern sm stroke width