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',
|
||||
'i18n',
|
||||
'logo',
|
||||
//'measurements',
|
||||
'measurements',
|
||||
//'mirror',
|
||||
//'notches',
|
||||
//'round',
|
||||
|
@ -67,7 +67,7 @@ export default {
|
|||
],
|
||||
options: {
|
||||
plugin: {
|
||||
dflt: 'logo',
|
||||
dflt: 'measurements',
|
||||
list: [
|
||||
'all',
|
||||
'banner',
|
||||
|
|
|
@ -12,7 +12,7 @@ import grainline from '@freesewing/plugin-grainline'
|
|||
// Not importing i18n since it's a run-time plugin loaded by workbench
|
||||
//import i18n from '@freesewing/plugin-i18n'
|
||||
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 notches from '@freesewing/plugin-notches'
|
||||
//import round from '@freesewing/plugin-round'
|
||||
|
@ -34,7 +34,7 @@ import draftGore from './plugin-gore'
|
|||
import draftGrainline from './plugin-grainline'
|
||||
import draftI18n from './plugin-i18n'
|
||||
import draftLogo from './plugin-logo'
|
||||
//import draftMeasurements from './plugin-measurements'
|
||||
import draftMeasurements from './plugin-measurements'
|
||||
//import draftMirror from './plugin-mirror'
|
||||
//import draftNotches from './plugin-notches'
|
||||
//import draftRound from './plugin-round'
|
||||
|
@ -62,7 +62,7 @@ const plugins = [
|
|||
// Not using i18n since it's a run-time plugin loaded by workbench
|
||||
// i18n,
|
||||
logo,
|
||||
// measurements,
|
||||
measurements,
|
||||
// mirror,
|
||||
// notches,
|
||||
// round,
|
||||
|
@ -86,7 +86,7 @@ const methods = {
|
|||
draftGrainline,
|
||||
draftI18n,
|
||||
draftLogo,
|
||||
// draftMeasurements,
|
||||
draftMeasurements,
|
||||
// draftMirror,
|
||||
// draftNotches,
|
||||
// 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