MCPcopy Create free account
hub / github.com/facebook/Rapid / transform

Method transform

modules/core/MapSystem.js:529–540  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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 /**

Callers 6

setMapParamsMethod · 0.95
panMethod · 0.95
transformEaseMethod · 0.95
_pointermoveMethod · 0.80
_wheelMethod · 0.80
_finishFunction · 0.80

Calls 1

setTransformAsyncMethod · 0.45

Tested by

no test coverage detected