2019-08-03 15:03:33 +02:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import Brian from '@freesewing/brian'
|
|
|
|
import plugins from '@freesewing/plugin-bundle'
|
2022-07-09 17:20:19 +02:00
|
|
|
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
|
|
|
|
2022-07-09 17:20:19 +02: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
|
|
|
|
|
2019-02-16 11:38:29 +01:00
|
|
|
// Create design
|
2022-07-09 17:20:19 +02:00
|
|
|
const Hugo = new freesewing.Design(config, plugins, { plugin, condition })
|
2018-12-20 11:41:35 +01:00
|
|
|
|
2019-02-16 11:38:29 +01:00
|
|
|
// Attach draft methods to prototype
|
2022-06-14 13:09:10 +02:00
|
|
|
Hugo.prototype.draftBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftBase(part)
|
|
|
|
}
|
2022-06-14 13:09:10 +02:00
|
|
|
Hugo.prototype.draftFrontBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftFront(part)
|
|
|
|
}
|
2022-06-14 13:09:10 +02:00
|
|
|
Hugo.prototype.draftBackBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftBack(part)
|
|
|
|
}
|
2022-06-14 13:09:10 +02:00
|
|
|
Hugo.prototype.draftSleeveBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftSleeve(part)
|
|
|
|
}
|
2022-06-14 13:09:10 +02:00
|
|
|
Hugo.prototype.draftSleevecap = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftSleevecap(part)
|
|
|
|
}
|
2022-06-14 13:09:10 +02:00
|
|
|
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
|
|
|
|
2022-06-14 13:09:10 +02:00
|
|
|
// Named exports
|
|
|
|
export { config, Hugo }
|
|
|
|
|
|
|
|
// Default export
|
|
|
|
export default Hugo
|