MCPcopy Create free account
hub / github.com/openscopeproject/InteractiveHtmlBom / applyRotation

Function applyRotation

InteractiveHtmlBom/web/render.js:620–634  ·  view source on GitHub ↗
(bbox, flip)

Source from the content-addressed store, hash-verified

618}
619
620function 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
636function recalcLayerScale(layerdict, width, height) {
637 var flip = (layerdict.layer === "B");

Callers 1

recalcLayerScaleFunction · 0.85

Calls 1

rotateVectorFunction · 0.85

Tested by

no test coverage detected