Skip to content

Commit

Permalink
fix: potential zoom validation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc authored and tiensonqin committed Jan 5, 2023
1 parent e03d48d commit f1ba934
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tldraw/packages/core/src/lib/TLViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export class TLViewport {
}

@action update = ({ point, zoom }: Partial<{ point: number[]; zoom: number }>): this => {
if (point !== undefined) this.camera.point = point
if (zoom !== undefined) this.camera.zoom = zoom
if (point !== undefined && !isNaN(point[0]) && !isNaN(point[1])) this.camera.point = point
if (zoom !== undefined && !isNaN(zoom)) this.camera.zoom = Math.min(4, Math.max(0.1, zoom))
return this
}

Expand Down

0 comments on commit f1ba934

Please sign in to comment.