You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let k = new knitout.Writer();
//right now, k.mapper === null, which implies full gauge
k.knit('+', 'f' + 7, '6'); //knits on needle f7
k.setMapper(new knitout.HalfGaugeMapper());
k.knit('+', 'f' + 7, '6'); //knits on needle f17
k.unmappedKnit('+', 'f' + 7, '6'); //knits on needle f7
Where a Mapper is an object with two functions:
function MyMapper() { }
MyMapper.prototype.toMachine(bed, needle) {
return {bed:bed, needle:needle*2};
}
//We could probably eliminate this one, but it turns out to be useful in certain cases:
MyMapper.prototype.fromMachine(bed, needle) {
return {bed:bed, needle:needle/2};
}
This is not the only possible interface. For instance, a 'Mapper' could be an object that takes a knitout.Writer and proxies calls to it:
let k = new knitout.Writer();
let k2 = new knitout.HalfGaugeMapper({writer:k});
k.knit('+', 'f' + 7, '6'); //knits on needle f7
k2.knit('+', 'f' + 7, '6'); //knits on needle f17
Open questions:
how do we deal with mapping in the context of querying active needles on the machine? (I.e. if mapping is enabled, do we report actual machine locations that are occupied, or the needles that map to them?)
Add support for remapping needle numbers to chosen gauges (full and half, possibly other a/b gauges)
The text was updated successfully, but these errors were encountered: