2019-08-03 15:03:33 +02:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import plugins from '@freesewing/plugin-bundle'
|
2021-06-13 12:35:52 +02:00
|
|
|
import mirrorPlugin from '@freesewing/plugin-mirror'
|
2022-07-09 17:27:45 +02:00
|
|
|
import plugin from '@freesewing/plugin-bust' // Note: conditional plugin
|
2019-08-03 15:03:33 +02:00
|
|
|
import Brian from '@freesewing/brian'
|
|
|
|
import config from '../config'
|
2019-02-26 17:46:07 +01:00
|
|
|
// Parts
|
2019-08-03 15:03:33 +02:00
|
|
|
import draftSleeve from './sleeve'
|
|
|
|
import draftTopSleeve from './topsleeve'
|
|
|
|
import draftUnderSleeve from './undersleeve'
|
2019-02-26 17:46:07 +01:00
|
|
|
|
2022-07-09 17:27:45 +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-26 17:46:07 +01:00
|
|
|
// Create new design
|
2022-07-09 17:27:45 +02:00
|
|
|
const Bent = new freesewing.Design(config, [plugins, mirrorPlugin], { plugin, condition })
|
2019-02-26 17:46:07 +01:00
|
|
|
|
|
|
|
// Attach draft methods from Brian to prototype
|
2022-06-14 13:04:17 +02:00
|
|
|
Bent.prototype.draftBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftBase(part)
|
|
|
|
}
|
2022-06-14 13:04:17 +02:00
|
|
|
Bent.prototype.draftFront = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftFront(part)
|
|
|
|
}
|
2022-06-14 13:04:17 +02:00
|
|
|
Bent.prototype.draftBack = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Brian(this.settings).draftBack(part)
|
|
|
|
}
|
2019-02-26 17:46:07 +01:00
|
|
|
|
|
|
|
// Attach own draft methods to prototype
|
2022-06-14 13:04:17 +02:00
|
|
|
Bent.prototype.draftSleeve = draftSleeve
|
|
|
|
Bent.prototype.draftTopSleeve = draftTopSleeve
|
|
|
|
Bent.prototype.draftUnderSleeve = draftUnderSleeve
|
2019-02-26 17:46:07 +01:00
|
|
|
|
2022-06-14 13:04:17 +02:00
|
|
|
// Named exports
|
|
|
|
export { config, Bent }
|
|
|
|
|
|
|
|
// Default export
|
|
|
|
export default Bent
|