Skip to content

Commit

Permalink
Make code more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Apr 11, 2018
1 parent 4f935cc commit e7ed76b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@ function render () {
minY = Math.min(minY, edge.y - edge.height / 2)
maxX = Math.max(maxX, edge.x + edge.width / 2)
maxY = Math.max(maxY, edge.y + edge.height / 2)
} else {
const points = edge.points.slice(1, edge.points.length - 1) // intersetion points don't matter
for (let i = 0; i < points.length; i++) {
const point = points[i]
minX = Math.min(minX, point.x)
minY = Math.min(minY, point.y)
maxX = Math.max(maxX, point.x)
maxY = Math.max(maxY, point.y)
}
}
const points = edge.points.slice(1, edge.points.length - 1) // intersetion points don't matter
for (let i = 0; i < points.length; i++) {
const point = points[i]
minX = Math.min(minX, point.x)
minY = Math.min(minY, point.y)
maxX = Math.max(maxX, point.x)
maxY = Math.max(maxY, point.y)
}
})

Expand Down

0 comments on commit e7ed76b

Please sign in to comment.