1
0
Fork 0

store methods don't become properties on shorthand

This commit is contained in:
Enoch Riese 2023-03-12 09:19:50 -05:00
parent aaa25b76f3
commit 49748a7c00
25 changed files with 95 additions and 80 deletions

View file

@ -135,15 +135,6 @@ Part.prototype.shorthand = function () {
utils: utils,
Bezier: Bezier,
}
// Add top-level store methods and add a part name parameter
const partName = this.name
for (const [key, method] of Object.entries(this.context.store)) {
if (typeof method === 'function')
shorthand[key] = function (...args) {
return method(partName, ...args)
}
}
// We'll need this
let self = this

View file

@ -160,6 +160,7 @@ Pattern.prototype.createPartForSet = function (partName, set = 0) {
Pattern.prototype.draftPartForSet = function (partName, set) {
if (typeof this.config.parts?.[partName]?.draft === 'function') {
this.activePart = partName
this.setStores[set].set('activePart', partName)
try {
this.__runHooks('prePartDraft')
const result = this.config.parts[partName].draft(this.parts[set][partName].shorthand())