MCPcopy Create free account
hub / github.com/alefore/knit / build

Method build

src/triangles_pattern_factory.ts:128–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 }
127
128 build(): Pattern {
129 const output = new Pattern();
130 const knittingStyle = this.knittingStyleInput.value() as RowSwitchStyle;
131 output.rowSwitchStyle = knittingStyle;
132
133 for (let rowIndex = 0; rowIndex < this.lengthInput.numberValue();
134 rowIndex++) {
135 let stitches: Stitch[] = [];
136 const invertOrder =
137 knittingStyle === RowSwitchStyles.backAndForth && rowIndex % 2 === 1;
138 for (let section = 0; section < this.sectionCountInput.numberValue();
139 section++) {
140 const actualSection = invertOrder ?
141 this.sectionCountInput.numberValue() - section - 1 :
142 section;
143 stitches.push(...this.sections[actualSection]!.getStitches(
144 rowIndex, this.lengthInput.numberValue()));
145 }
146 output.addRow(new Row(stitches));
147 }
148 return output;
149 }
150}
151
152PatternFactoryRegistry.register('Triangles', TrianglesPatternFactory);

Callers

nothing calls this directly

Calls 4

addRowMethod · 0.95
valueMethod · 0.80
numberValueMethod · 0.80
getStitchesMethod · 0.80

Tested by

no test coverage detected