1
0
Fork 0
freesewing/packages/hugo/src/index.js

57 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-09-21 21:30:20 +02:00
import freesewing from "freesewing";
2018-12-20 11:41:35 +01:00
import Brian from "@freesewing/brian";
import plugins from "@freesewing/plugin-bundle";
2018-09-21 21:30:20 +02:00
import config from "../config/config";
2018-12-20 11:41:35 +01:00
// Parts
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";
// Constructor boilerplate
const Hugo = function(settings) {
freesewing.Pattern.call(this, config);
this
.use(plugins)
.apply(settings);
2018-12-20 11:41:35 +01:00
return this;
2018-09-21 21:30:20 +02:00
};
// Set up inheritance
2018-12-20 11:41:35 +01:00
Hugo.prototype = Object.create(freesewing.Pattern.prototype);
Hugo.prototype.constructor = Hugo;
// Attach per-part draft methods to prototype
Hugo.prototype.draftBase = function (part) {
return new Brian(this.settings).draftBase(part);
}
Hugo.prototype.draftFrontBase = function (part) {
return new Brian(this.settings).draftFront(part);
}
Hugo.prototype.draftBackBase = function (part) {
return new Brian(this.settings).draftBack(part);
}
Hugo.prototype.draftSleeveBase = function (part) {
return new Brian(this.settings).draftSleeve(part);
}
Hugo.prototype.draftSleevecap = function (part) {
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;
export default Hugo;