Skip to content

Commit

Permalink
Merge pull request #23 from tscircuit/refactor-dependency
Browse files Browse the repository at this point in the history
type fix
  • Loading branch information
imrishabh18 authored Oct 10, 2024
2 parents d509bca + 7387ecb commit 29a33df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/find-bounds-and-center.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ export const findBoundsAndCenter = (
.concat(
elements
.filter((elm) => elm.type === "pcb_trace")
.flatMap((elm) => elm.route),
// @ts-ignore
.flatMap((elm: PcbTrace) => elm.route),
)
.map((elm) => getDebugLayoutObject(elm))
.filter(isTruthy)

if (debugObjects.length === 0)
return { center: { x: 0, y: 0 }, width: 0, height: 0 }

let minX = debugObjects[0].x - debugObjects[0].width / 2
let maxX = debugObjects[0].x + debugObjects[0].width / 2
let minY = debugObjects[0].y - debugObjects[0].height / 2
let maxY = debugObjects[0].y + debugObjects[0].height / 2
let minX = debugObjects[0]!.x - debugObjects[0]!.width / 2
let maxX = debugObjects[0]!.x + debugObjects[0]!.width / 2
let minY = debugObjects[0]!.y - debugObjects[0]!.height / 2
let maxY = debugObjects[0]!.y + debugObjects[0]!.height / 2

for (const obj of debugObjects.slice(1)) {
minX = Math.min(minX, obj.x - obj.width / 2)
Expand Down

0 comments on commit 29a33df

Please sign in to comment.