(pattern: Pattern)
| 17 | } |
| 18 | |
| 19 | public getPatternDimensions(pattern: Pattern) { |
| 20 | const unflippedPatternSizeStitches = { |
| 21 | x: pattern.rowsCount(), |
| 22 | y: Math.max(...pattern.rows.map(row => row.outputStitches)) |
| 23 | }; |
| 24 | |
| 25 | const baseStitchSizeWidth = |
| 26 | this.canvas.width / unflippedPatternSizeStitches.x; |
| 27 | const baseStitchSizeHeight = |
| 28 | this.canvas.height / unflippedPatternSizeStitches.y; |
| 29 | const stitchSizeAtZoom1 = |
| 30 | Math.min(baseStitchSizeWidth, baseStitchSizeHeight); |
| 31 | const unflippedPatternSizePixels = |
| 32 | scale(unflippedPatternSizeStitches, stitchSizeAtZoom1); |
| 33 | |
| 34 | return { |
| 35 | unflippedPatternSizeStitches, |
| 36 | unflippedPatternSizePixels, |
| 37 | baseStitchSizeWidth, |
| 38 | baseStitchSizeHeight, |
| 39 | stitchSizeAtZoom1, |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | public render( |
| 44 | pattern: Pattern, zoomLevel: number, offset: KnitPoint, |
no test coverage detected