'use strict'; const { metersAt } = require('../geometry/metric'); // Pure geometry helpers for the cluster-level island drag. This module does // not mutate compiler features; callers can validate the returned rings before // publishing a preview. function radialShift(center, islandCenter, distanceMeters) { const { lon, lat } = metersAt(center[1]); const east = (islandCenter[0] - center[0]) * lon; const north = (islandCenter[1] - center[1]) * lat; const length = Math.hypot(east, north); if (!Number.isFinite(length) || length < 1e-9 || !Number.isFinite(distanceMeters)) return [0, 0]; return [(distanceMeters * east) / length / lon, (distanceMeters * north) / length / lat]; } module.exports = { radialShift };