2019-08-03 15:03:33 +02:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import plugins from '@freesewing/plugin-bundle'
|
2022-07-09 17:32:27 +02:00
|
|
|
import plugin from '@freesewing/plugin-bust' // Note: conditional plugin
|
2019-08-03 15:03:33 +02:00
|
|
|
import Bent from '@freesewing/bent'
|
|
|
|
import config from '../config'
|
2019-03-25 18:20:15 +01:00
|
|
|
// Parts
|
2019-08-03 15:03:33 +02:00
|
|
|
import draftFront from './front'
|
|
|
|
import draftBack from './back'
|
|
|
|
import draftTail from './tail'
|
|
|
|
import draftTopSleeve from './topsleeve'
|
|
|
|
import draftUnderSleeve from './undersleeve'
|
|
|
|
import draftBelt from './belt'
|
|
|
|
import draftCollarStand from './collarstand'
|
|
|
|
import draftCollar from './collar'
|
|
|
|
import draftCuffFacing from './cufffacing'
|
|
|
|
import draftPocket from './pocket'
|
|
|
|
import draftPocketFlap from './pocketflap'
|
|
|
|
import draftPocketLining from './pocketlining'
|
|
|
|
import draftChestPocketWelt from './chestpocketwelt'
|
|
|
|
import draftChestPocketBag from './chestpocketbag'
|
|
|
|
import draftInnerPocketWelt from './innerpocketwelt'
|
|
|
|
import draftInnerPocketBag from './innerpocketbag'
|
|
|
|
import draftInnerPocketTab from './innerpockettab'
|
2019-03-25 18:20:15 +01:00
|
|
|
|
2022-07-09 17:32:27 +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 Carlton = new freesewing.Design(config, plugins, { plugin, condition })
|
2019-03-25 18:20:15 +01:00
|
|
|
|
|
|
|
// Attach draft methods from Bent to prototype
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentBase = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftBase(part)
|
|
|
|
}
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentFront = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftFront(part)
|
|
|
|
}
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentBack = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftBack(part)
|
|
|
|
}
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentSleeve = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftSleeve(part)
|
|
|
|
}
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentTopSleeve = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftTopSleeve(part)
|
|
|
|
}
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftBentUnderSleeve = function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return new Bent(this.settings).draftUnderSleeve(part)
|
|
|
|
}
|
2019-03-25 18:20:15 +01:00
|
|
|
|
|
|
|
// Attach own draft methods to prototype
|
2022-06-14 13:09:08 +02:00
|
|
|
Carlton.prototype.draftFront = draftFront
|
|
|
|
Carlton.prototype.draftBack = draftBack
|
|
|
|
Carlton.prototype.draftTail = draftTail
|
|
|
|
Carlton.prototype.draftTopSleeve = draftTopSleeve
|
|
|
|
Carlton.prototype.draftUnderSleeve = draftUnderSleeve
|
|
|
|
Carlton.prototype.draftBelt = draftBelt
|
|
|
|
Carlton.prototype.draftCollarStand = draftCollarStand
|
|
|
|
Carlton.prototype.draftCollar = draftCollar
|
|
|
|
Carlton.prototype.draftCuffFacing = draftCuffFacing
|
|
|
|
Carlton.prototype.draftPocket = draftPocket
|
|
|
|
Carlton.prototype.draftPocketFlap = draftPocketFlap
|
|
|
|
Carlton.prototype.draftPocketLining = draftPocketLining
|
|
|
|
Carlton.prototype.draftChestPocketWelt = draftChestPocketWelt
|
|
|
|
Carlton.prototype.draftChestPocketBag = draftChestPocketBag
|
|
|
|
Carlton.prototype.draftInnerPocketWelt = draftInnerPocketWelt
|
|
|
|
Carlton.prototype.draftInnerPocketBag = draftInnerPocketBag
|
|
|
|
Carlton.prototype.draftInnerPocketTab = draftInnerPocketTab
|
2019-03-25 18:20:15 +01:00
|
|
|
|
2022-06-14 13:09:08 +02:00
|
|
|
// Named exports
|
|
|
|
export { config, Carlton }
|
|
|
|
|
|
|
|
// Default export
|
|
|
|
export default Carlton
|