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

63 lines
2 KiB
JavaScript
Raw Normal View History

2019-08-03 15:03:33 +02:00
import freesewing from '@freesewing/core'
import Brian from '@freesewing/brian'
import plugins from '@freesewing/plugin-bundle'
import plugin from '@freesewing/plugin-bust' // Note: conditional plugin
2019-08-03 15:03:33 +02:00
import config from '../config'
2018-12-20 11:41:35 +01:00
// Parts
2019-08-03 15:03:33 +02:00
import draftBack from './back'
import draftFront from './front'
import draftSleeve from './sleeve'
import draftPocket from './pocket'
import draftPocketFacing from './pocketfacing'
import draftHoodSide from './hoodside'
import draftHoodCenter from './hoodcenter'
import draftWaistband from './waistband'
import draftCuff from './cuff'
2018-12-20 11:41:35 +01:00
/* 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 Hugo = new freesewing.Design(config, plugins, { plugin, condition })
2018-12-20 11:41:35 +01:00
// Attach draft methods to prototype
Hugo.prototype.draftBase = function (part) {
2019-08-03 15:03:33 +02:00
return new Brian(this.settings).draftBase(part)
}
Hugo.prototype.draftFrontBase = function (part) {
2019-08-03 15:03:33 +02:00
return new Brian(this.settings).draftFront(part)
}
Hugo.prototype.draftBackBase = function (part) {
2019-08-03 15:03:33 +02:00
return new Brian(this.settings).draftBack(part)
}
Hugo.prototype.draftSleeveBase = function (part) {
2019-08-03 15:03:33 +02:00
return new Brian(this.settings).draftSleeve(part)
}
Hugo.prototype.draftSleevecap = function (part) {
2019-08-03 15:03:33 +02:00
return new Brian(this.settings).draftSleevecap(part)
}
Hugo.prototype.draftBack = draftBack
Hugo.prototype.draftFront = draftFront
Hugo.prototype.draftSleeve = draftSleeve
Hugo.prototype.draftPocket = draftPocket
Hugo.prototype.draftPocketFacing = draftPocketFacing
Hugo.prototype.draftHoodSide = draftHoodSide
Hugo.prototype.draftHoodCenter = draftHoodCenter
Hugo.prototype.draftWaistband = draftWaistband
Hugo.prototype.draftCuff = draftCuff
2018-12-20 11:41:35 +01:00
// Named exports
export { config, Hugo }
// Default export
export default Hugo