nidus-sync/ts/type/map.ts
Eli Ribble a2b8527d91
Track user location with map and address data
This is useful because everywhere that we use the AddressAndMapLocator
component we also want to use the user's location and we want to zoom
the map based on their location. Instead of tracking this externally in
3 places we just pull it into the component.
2026-04-27 19:44:25 +00:00

30 lines
679 B
TypeScript

import maplibregl from "maplibre-gl";
import { Address, Location } from "@/type/api";
export class Camera {
location: Location;
zoom: number;
constructor(location: Location = new Location(), zoom: number = 0) {
this.location = location;
this.zoom = zoom;
}
}
export class Locator {
address: Address;
location: Location;
constructor(
address: Address = new Address(),
location: Location = new Location(),
) {
this.address = address;
this.location = location;
}
}
export type MoveEndEventInternal = maplibregl.MapLibreEvent<
| maplibregl.MapMouseEvent
| maplibregl.MapTouchEvent
| maplibregl.MapWheelEvent
| undefined
> & {
isInternalUpdate: boolean;
};