1
0
Fork 0
freesewing/designs/yuri/src/index.mjs

59 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-07-25 19:56:42 +02:00
import freesewing from '@freesewing/core'
import plugins from '@freesewing/plugin-bundle'
import plugin from '@freesewing/plugin-bust' // Note: conditional plugin
2021-07-25 19:56:42 +02:00
import Brian from '@freesewing/brian'
import config from '../config'
// Parts
import draftBack from './back'
import draftFront from './front'
import draftSleeve from './sleeve'
import draftGusset from './gusset'
import draftHoodSide from './hoodside'
import draftHoodCenter from './hoodcenter'
/* Check to see whether we should load the bust plugin
* Only of the `draftForHighBust` options is set
* AND the highBust measurement is available
*/
const condition = (settings = false) =>
settings &&
settings.options &&
settings.options.draftForHighBust &&
settings.measurements.highBust
? true
: false
// Create design
const Yuri = new freesewing.Design(config, plugins, { plugin, condition })
2021-07-25 19:56:42 +02:00
// Attach draft methods from Brian to prototype
Yuri.prototype.draftBase = function (part) {
2021-07-25 19:56:42 +02:00
return new Brian(this.settings).draftBase(part)
}
Yuri.prototype.draftFrontBase = function (part) {
2021-07-25 19:56:42 +02:00
return new Brian(this.settings).draftFront(part)
}
Yuri.prototype.draftBackBase = function (part) {
2021-07-25 19:56:42 +02:00
return new Brian(this.settings).draftBack(part)
}
Yuri.prototype.draftSleevecap = function (part) {
2021-07-25 19:56:42 +02:00
return new Brian(this.settings).draftSleevecap(part)
}
Yuri.prototype.draftSleeveBase = function (part) {
2021-07-25 19:56:42 +02:00
return new Brian(this.settings).draftSleeve(part)
}
// Attach own draft methods to prototype
Yuri.prototype.draftBack = draftBack
Yuri.prototype.draftFront = draftFront
Yuri.prototype.draftSleeve = draftSleeve
Yuri.prototype.draftGusset = draftGusset
Yuri.prototype.draftHoodSide = draftHoodSide
Yuri.prototype.draftHoodCenter = draftHoodCenter
2021-07-25 19:56:42 +02:00
// Named exports
export { config, Yuri }
// Default export
export default Yuri