2021-07-25 19:56:42 +02:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import plugins from '@freesewing/plugin-bundle'
|
2022-07-09 17:58:34 +02:00
|
|
|
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'
|
|
|
|
|
2022-07-09 17:58:34 +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
|
|
|
|
|
|
|
|
// 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
|
2022-06-14 13:09:18 +02:00
|
|
|
Yuri.prototype.draftBase = function (part) {
|
2021-07-25 19:56:42 +02:00
|
|
|
return new Brian(this.settings).draftBase(part)
|
|
|
|
}
|
2022-06-14 13:09:18 +02:00
|
|
|
Yuri.prototype.draftFrontBase = function (part) {
|
2021-07-25 19:56:42 +02:00
|
|
|
return new Brian(this.settings).draftFront(part)
|
|
|
|
}
|
2022-06-14 13:09:18 +02:00
|
|
|
Yuri.prototype.draftBackBase = function (part) {
|
2021-07-25 19:56:42 +02:00
|
|
|
return new Brian(this.settings).draftBack(part)
|
|
|
|
}
|
2022-06-14 13:09:18 +02:00
|
|
|
Yuri.prototype.draftSleevecap = function (part) {
|
2021-07-25 19:56:42 +02:00
|
|
|
return new Brian(this.settings).draftSleevecap(part)
|
|
|
|
}
|
2022-06-14 13:09:18 +02:00
|
|
|
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
|
2022-06-14 13:09:18 +02:00
|
|
|
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
|
|
|
|
2022-06-14 13:09:18 +02:00
|
|
|
// Named exports
|
|
|
|
export { config, Yuri }
|
|
|
|
|
|
|
|
// Default export
|
|
|
|
export default Yuri
|