feat(plugintest): Added plugin-measurements
This commit is contained in:
parent
684a71a8d8
commit
303176f513
3 changed files with 40 additions and 6 deletions
|
@ -53,7 +53,7 @@ export default {
|
||||||
'grainline',
|
'grainline',
|
||||||
'i18n',
|
'i18n',
|
||||||
'logo',
|
'logo',
|
||||||
//'measurements',
|
'measurements',
|
||||||
//'mirror',
|
//'mirror',
|
||||||
//'notches',
|
//'notches',
|
||||||
//'round',
|
//'round',
|
||||||
|
@ -67,7 +67,7 @@ export default {
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'logo',
|
dflt: 'measurements',
|
||||||
list: [
|
list: [
|
||||||
'all',
|
'all',
|
||||||
'banner',
|
'banner',
|
||||||
|
|
|
@ -12,7 +12,7 @@ import grainline from '@freesewing/plugin-grainline'
|
||||||
// Not importing i18n since it's a run-time plugin loaded by workbench
|
// Not importing i18n since it's a run-time plugin loaded by workbench
|
||||||
//import i18n from '@freesewing/plugin-i18n'
|
//import i18n from '@freesewing/plugin-i18n'
|
||||||
import logo from '@freesewing/plugin-logo'
|
import logo from '@freesewing/plugin-logo'
|
||||||
//import measurements from '@freesewing/plugin-measurements'
|
import measurements from '@freesewing/plugin-measurements'
|
||||||
//import mirror from '@freesewing/plugin-mirror'
|
//import mirror from '@freesewing/plugin-mirror'
|
||||||
//import notches from '@freesewing/plugin-notches'
|
//import notches from '@freesewing/plugin-notches'
|
||||||
//import round from '@freesewing/plugin-round'
|
//import round from '@freesewing/plugin-round'
|
||||||
|
@ -34,7 +34,7 @@ import draftGore from './plugin-gore'
|
||||||
import draftGrainline from './plugin-grainline'
|
import draftGrainline from './plugin-grainline'
|
||||||
import draftI18n from './plugin-i18n'
|
import draftI18n from './plugin-i18n'
|
||||||
import draftLogo from './plugin-logo'
|
import draftLogo from './plugin-logo'
|
||||||
//import draftMeasurements from './plugin-measurements'
|
import draftMeasurements from './plugin-measurements'
|
||||||
//import draftMirror from './plugin-mirror'
|
//import draftMirror from './plugin-mirror'
|
||||||
//import draftNotches from './plugin-notches'
|
//import draftNotches from './plugin-notches'
|
||||||
//import draftRound from './plugin-round'
|
//import draftRound from './plugin-round'
|
||||||
|
@ -62,7 +62,7 @@ const plugins = [
|
||||||
// Not using i18n since it's a run-time plugin loaded by workbench
|
// Not using i18n since it's a run-time plugin loaded by workbench
|
||||||
// i18n,
|
// i18n,
|
||||||
logo,
|
logo,
|
||||||
// measurements,
|
measurements,
|
||||||
// mirror,
|
// mirror,
|
||||||
// notches,
|
// notches,
|
||||||
// round,
|
// round,
|
||||||
|
@ -86,7 +86,7 @@ const methods = {
|
||||||
draftGrainline,
|
draftGrainline,
|
||||||
draftI18n,
|
draftI18n,
|
||||||
draftLogo,
|
draftLogo,
|
||||||
// draftMeasurements,
|
draftMeasurements,
|
||||||
// draftMirror,
|
// draftMirror,
|
||||||
// draftNotches,
|
// draftNotches,
|
||||||
// draftRound,
|
// draftRound,
|
||||||
|
|
34
packages/plugintest/src/plugin-measurements.js
Normal file
34
packages/plugintest/src/plugin-measurements.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
const measies = [
|
||||||
|
'seatFront',
|
||||||
|
'seatBackArc',
|
||||||
|
'seatFrontArc',
|
||||||
|
'waistFront',
|
||||||
|
'waistBackArc',
|
||||||
|
'waistFrontArc',
|
||||||
|
'crossSeamFront',
|
||||||
|
'crossSeamBack',
|
||||||
|
]
|
||||||
|
|
||||||
|
const draftI18n = part => {
|
||||||
|
|
||||||
|
const { points, Point, paths, Path, measurements, options } = part.shorthand()
|
||||||
|
|
||||||
|
if (['measurements', 'all'].indexOf(options.plugin) !== -1) {
|
||||||
|
|
||||||
|
let y = 10
|
||||||
|
for (const m of measies) {
|
||||||
|
points[m] = new Point(0, y).attr('data-text', [m, measurements[m]])
|
||||||
|
y += 10
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent clipping of text
|
||||||
|
paths.box = new Path()
|
||||||
|
.move(new Point(0,-10))
|
||||||
|
.line(new Point(130, 90))
|
||||||
|
.attr('class', 'hidden')
|
||||||
|
}
|
||||||
|
|
||||||
|
return part
|
||||||
|
}
|
||||||
|
|
||||||
|
export default draftI18n
|
Loading…
Add table
Add a link
Reference in a new issue