Skip to content

Commit

Permalink
When setting transform params, don't ignore '0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel committed Feb 22, 2024
1 parent 9d3c2d8 commit 852d6f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/math/src/Viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ export class Viewport {
transform(obj?: any): Transform | Viewport {
if (obj === undefined) return Object.assign({}, this._transform); // copy

if (obj.x) this._transform.x = +obj.x;
if (obj.y) this._transform.y = +obj.y;
if (obj.k) this._transform.k = clamp(+obj.k, MINK, MAXK); // constrain to z0..z24
if (obj.r) this._transform.r = wrap(+obj.r, 0, TAU); // constrain to 0..2π
if (obj.x !== undefined) this._transform.x = +obj.x;
if (obj.y !== undefined) this._transform.y = +obj.y;
if (obj.k !== undefined) this._transform.k = clamp(+obj.k, MINK, MAXK); // constrain to z0..z24
if (obj.r !== undefined) this._transform.r = wrap(+obj.r, 0, TAU); // constrain to 0..2π

return this;
}
Expand Down

0 comments on commit 852d6f2

Please sign in to comment.