MCPcopy Index your code
hub / github.com/microsoft/SandDance / getFlyToTransitionParams

Function getFlyToTransitionParams

docs/app/js/sanddance-app.js:80703–80743  ·  view source on GitHub ↗
(startProps, endProps, opts)

Source from the content-addressed store, hash-verified

80701 return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
80702}
80703function getFlyToTransitionParams(startProps, endProps, opts) {
80704 opts = Object.assign({}, DEFAULT_OPTS, opts);
80705 const rho = opts.curve;
80706 const startZoom = startProps.zoom;
80707 const startCenter = [
80708 startProps.longitude,
80709 startProps.latitude
80710 ];
80711 const startScale = (0, _webMercatorUtils.zoomToScale)(startZoom);
80712 const endZoom = endProps.zoom;
80713 const endCenter = [
80714 endProps.longitude,
80715 endProps.latitude
80716 ];
80717 const scale = (0, _webMercatorUtils.zoomToScale)(endZoom - startZoom);
80718 const startCenterXY = (0, _webMercatorUtils.lngLatToWorld)(startCenter);
80719 const endCenterXY = (0, _webMercatorUtils.lngLatToWorld)(endCenter);
80720 const uDelta = _vec2.sub([], endCenterXY, startCenterXY);
80721 const w0 = Math.max(startProps.width, startProps.height);
80722 const w1 = w0 / scale;
80723 const u1 = _vec2.length(uDelta) * startScale;
80724 const _u1 = Math.max(u1, EPSILON);
80725 const rho2 = rho * rho;
80726 const b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * _u1 * _u1) / (2 * w0 * rho2 * _u1);
80727 const b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * _u1 * _u1) / (2 * w1 * rho2 * _u1);
80728 const r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
80729 const r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
80730 const S = (r1 - r0) / rho;
80731 return {
80732 startZoom,
80733 startCenterXY,
80734 uDelta,
80735 w0,
80736 u1,
80737 S,
80738 rho,
80739 rho2,
80740 r0,
80741 r1
80742 };
80743}
80744
80745},{"./math-utils":"g3X8f","./web-mercator-utils":"dXGoy","gl-matrix/vec2":"29QfU","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"69ybw":[function(require,module,exports) {
80746var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers 2

flyToViewportFunction · 0.70
getFlyToDurationFunction · 0.70

Calls 3

subMethod · 0.45
maxMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected