Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Number.isFinite(endViewport[key]);
}
const viewport = {};
// TODO: add this as an option for applications.
const rho = 1.414;
const startZoom = startViewport.zoom;
const startCenter = [startViewport.longitude, startViewport.latitude];
const startScale = zoomToScale(startZoom);
const endZoom = endViewport.zoom;
const endCenter = [endViewport.longitude, endViewport.latitude];
const scale = zoomToScale(endZoom - startZoom);
const startCenterXY = new Vector2(projectFlat(startCenter, startScale));
const endCenterXY = new Vector2(projectFlat(endCenter, startScale));
const uDelta = endCenterXY.subtract(startCenterXY);
const w0 = Math.max(startViewport.width, startViewport.height);
const w1 = w0 / scale;
const u1 = Math.sqrt((uDelta.x * uDelta.x) + (uDelta.y * uDelta.y));
// u0 is treated as '0' in Eq (9).
// Linearly interpolate 'bearing' and 'pitch' if exist.
for (const key of ['bearing', 'pitch']) {
if (Number.isFinite(startViewport[key])) {
assert(Number.isFinite(endViewport[key]));
viewport[key] = lerp(startViewport[key], endViewport[key], t);
}
}
}
const viewport = {};
// TODO: add this as an option for applications.
const rho = 1.414;
const startZoom = startViewport.zoom;
const startCenter = [startViewport.longitude, startViewport.latitude];
const startScale = zoomToScale(startZoom);
const endZoom = endViewport.zoom;
const endCenter = [endViewport.longitude, endViewport.latitude];
const scale = zoomToScale(endZoom - startZoom);
const startCenterXY = new Vector2(projectFlat(startCenter, startScale));
const endCenterXY = new Vector2(projectFlat(endCenter, startScale));
const uDelta = endCenterXY.subtract(startCenterXY);
const w0 = Math.max(startViewport.width, startViewport.height);
const w1 = w0 / scale;
const u1 = Math.sqrt((uDelta.x * uDelta.x) + (uDelta.y * uDelta.y));
// u0 is treated as '0' in Eq (9).
// Linearly interpolate 'bearing' and 'pitch' if exist.
for (const key of ['bearing', 'pitch']) {
if (Number.isFinite(startViewport[key])) {
assert(Number.isFinite(endViewport[key]));
viewport[key] = lerp(startViewport[key], endViewport[key], t);
}
}
// If change in center is too small, do linear interpolaiton.