(bbox, flip)
| 618 | } |
| 619 | |
| 620 | function applyRotation(bbox, flip) { |
| 621 | var corners = [ |
| 622 | [bbox.minx, bbox.miny], |
| 623 | [bbox.minx, bbox.maxy], |
| 624 | [bbox.maxx, bbox.miny], |
| 625 | [bbox.maxx, bbox.maxy], |
| 626 | ]; |
| 627 | corners = corners.map((v) => rotateVector(v, settings.boardRotation + (flip && settings.offsetBackRotation ? - 180 : 0))); |
| 628 | return { |
| 629 | minx: corners.reduce((a, v) => Math.min(a, v[0]), Infinity), |
| 630 | miny: corners.reduce((a, v) => Math.min(a, v[1]), Infinity), |
| 631 | maxx: corners.reduce((a, v) => Math.max(a, v[0]), -Infinity), |
| 632 | maxy: corners.reduce((a, v) => Math.max(a, v[1]), -Infinity), |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | function recalcLayerScale(layerdict, width, height) { |
| 637 | var flip = (layerdict.layer === "B"); |
no test coverage detected