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

Method constructor

src/triangles_pattern_factory.ts:15–36  ·  view source on GitHub ↗
(
      sectionId: number, sectionCountInput: PatternFactoryInput,
      knittingStyleInput: PatternFactoryInput)

Source from the content-addressed store, hash-verified

13 knittingStyleInput: PatternFactoryInput;
14
15 constructor(
16 sectionId: number, sectionCountInput: PatternFactoryInput,
17 knittingStyleInput: PatternFactoryInput) {
18 this.widthTop = new PatternFactoryInput(
19 `${sectionId}: Top Width`,
20 `How wide should section ${sectionId} be at the top?`, 3, 'stitches');
21 this.widthBottom = new PatternFactoryInput(
22 `${sectionId}: Bottom Width`,
23 `How wide should section ${sectionId} be at the bottom?`, 30,
24 'stitches');
25 this.texture = new PatternFactoryInput(
26 `${sectionId}: Texture`,
27 `What type of pattern should section ${sectionId} use?`, 'Stockinette',
28 null, Array.from(texturesMap.keys()));
29 this.inputs = [this.widthTop, this.widthBottom, this.texture];
30 this.knittingStyleInput = knittingStyleInput;
31 this.inputs.forEach(
32 (i) => i.addVisibilityRequirement(
33 () => sectionCountInput.numberValue() > sectionId));
34 sectionCountInput.listener.addListener(
35 () => this.inputs.forEach((i) => i.adjustVisibility()));
36 }
37
38 getInputs(): PatternFactoryInput[] {
39 return this.inputs;

Callers

nothing calls this directly

Calls 4

numberValueMethod · 0.80
addListenerMethod · 0.80
adjustVisibilityMethod · 0.80

Tested by

no test coverage detected