* transform * Set/Get the map transform * IF setting, will schedule an update of map transform. * All convenience methods for adjusting the map go through here. * @param t2 Transform Object with `x`,`y`,`k`,`r` properties. * @param duration? Duration of the transition in mi
(t2, duration)
| 527 | * @return map transform -or- this |
| 528 | */ |
| 529 | transform(t2, duration) { |
| 530 | if (t2 === undefined) { |
| 531 | return this.context.viewport.transform.props; |
| 532 | } |
| 533 | |
| 534 | // Avoid tiny or out of bounds rotations |
| 535 | t2.r = numWrap((+(t2.r || 0).toFixed(3)), 0, TAU); // radians |
| 536 | |
| 537 | const gfx = this.context.systems.gfx; |
| 538 | gfx.setTransformAsync(t2, duration ?? 0); |
| 539 | return this; |
| 540 | } |
| 541 | |
| 542 | |
| 543 | /** |
no test coverage detected