Open ixchow opened 3 years ago
I added this as a fix for the following carrier placement issues:
carrierSpacing = 1
, the carriers push/scrape against each other when moved.carrierSpacing = 2
), it will frequently drop the edge stitches when picked up again to knit (due to too much slack and not enough security for the yarn).My solution was to allow for x-carrier-spacing N
to be equal to non-whole numbers in increments of 0.5, which tells the backend to alternate between: bumpAdd = Math.floor(N)
and bumpAdd = Math.ceil(N)
each time it bumps a carrier on a given side.
So if x-carrier-spacing 1.5
is specified in the knitout, if (Math.abs(add) % 1 === 0.5)
returns true
, and the boolean leftFloor
or rightFloor
(depending on whether add < 0
[meaning we're dealing with carriers on the left side] or vice versa) is toggled between true
(for that pass, the working carrier will be bumped 1 —> Math.floor(1.5)
), and false
(in the next pass, the working carrier will be bumped 2 —> Math.ceil(1.5)
). But if N is a whole number, the carrierSpacing is consistently equal to that number.
I've found this to be really helpful for situations where I'm using 5 or 6 carriers and a pattern that causes a lot of carrier stacking, but it is still definitely a quick fix and could be replaced with something more clear and sophisticated.
These variables enable what seems to be somewhat questionable behavior, need to review this code to understand what is being fixed and whether the fix is working.