1
0
Fork 0

change to bin-pack-with-constraints

This commit is contained in:
Enoch Riese 2023-02-27 18:58:47 -06:00
parent dc998d4e98
commit 6ba2e4e885
4 changed files with 9 additions and 8 deletions

View file

@ -53,7 +53,7 @@ charlie:
core:
_:
'bezier-js': '6.1.0'
'bin-pack': '1.0.2'
'bin-pack-with-constraints': '1.0.1'
'hooks': '0.3.2'
'lodash.get': &_get '4.4.2'
'lodash.set': &_set '4.3.2'

View file

@ -51,7 +51,7 @@
"peerDependencies": {},
"dependencies": {
"bezier-js": "6.1.0",
"bin-pack": "1.0.2",
"bin-pack-with-constraints": "1.0.1",
"hooks": "0.3.2",
"lodash.get": "4.4.2",
"lodash.set": "4.3.2",

View file

@ -1,5 +1,5 @@
import { Attributes } from './attributes.mjs'
import pack from 'bin-pack'
import pack from 'bin-pack-with-constraints'
import { __addNonEnumProp, __macroName } from './utils.mjs'
import { Part } from './part.mjs'
import { Stack } from './stack.mjs'
@ -72,6 +72,7 @@ Pattern.prototype.addPart = function (part, resolveImmediately = true) {
this.__configResolver.isPartValid(part) &&
!this.designConfig.parts.find((p) => p.name == part.name)
) {
this.store.log.debug(`Adding Part \`${part.name}\` at runtime`)
this.designConfig.parts.push(part)
if (resolveImmediately) {
if (this.__configResolver.addPart(part) && typeof this.draftQueue !== 'undefined')
@ -922,7 +923,7 @@ Pattern.prototype.__pack = function () {
}
}
if (this.settings[0].layout === true) {
let size = pack(bins, { inPlace: true })
let size = pack(bins, { inPlace: true, maxWidth: this.settings[0].maxWidth })
for (let bin of bins) {
this.autoLayout.stacks[bin.id] = { move: {} }
let stack = this.stacks[bin.id]

View file

@ -6254,10 +6254,10 @@ bin-links@^3.0.0:
rimraf "^3.0.0"
write-file-atomic "^4.0.0"
bin-pack@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bin-pack/-/bin-pack-1.0.2.tgz#c2a014edbf0bed70a3292062ed46577b96120679"
integrity sha512-aOk0SxEon5LF9cMxQFViSKb4qccG6rs7XKyMXIb1J8f8LA2acTIWnHdT0IOTe4gYBbqgjdbuTZ5f+UP+vlh4Mw==
bin-pack-with-constraints@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/bin-pack-with-constraints/-/bin-pack-with-constraints-1.0.1.tgz#47e67b481724a8a5a3644ec9c9ccf881c2725096"
integrity sha512-fiPxvZAWuIqLpK79Ov58PztT/ZiGbpDB7usifleilJ/4aqhSx0ivY5kRifESJnR2rq51pScbUJ0LgCebufGJnA==
binary-extensions@^2.0.0:
version "2.2.0"