aboutsummaryrefslogtreecommitdiff
path: root/frontend/ts/src/lib/leaflet.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/ts/src/lib/leaflet.d.ts')
-rw-r--r--frontend/ts/src/lib/leaflet.d.ts93
1 files changed, 93 insertions, 0 deletions
diff --git a/frontend/ts/src/lib/leaflet.d.ts b/frontend/ts/src/lib/leaflet.d.ts
new file mode 100644
index 0000000..76b88fd
--- /dev/null
+++ b/frontend/ts/src/lib/leaflet.d.ts
@@ -0,0 +1,93 @@
+// Map
+
+export function map(element: string | HTMLElement, options?: MapOptions): Map
+
+export interface MapOptions {
+ center: number[]
+ zoom: number
+ attributionControl: boolean
+}
+
+export interface Map {
+ addLayer: (layer: Layer | FeatureGroup) => void
+ removeLayer: (layer: Layer | FeatureGroup) => void
+ addEventListener: (name: string, fn: (e: MapEvent) => void) => void
+ getBounds: () => LatLngBounds
+ fitBounds: (bounds: LatLngBounds, options: { padding: [number, number] } | undefined) => void
+}
+
+// LatLngBounds
+
+export interface LatLngBounds {
+ contains: (otherBounds: LatLngBounds) => boolean
+}
+
+// Feature group
+
+export interface FeatureGroup {
+ clearLayers: () => void
+ addLayer: (layer: Layer | FeatureGroup) => void
+ removeLayer: (layer: Layer | FeatureGroup) => void
+ getBounds: () => LatLngBounds
+ getLayers: () => Array<Layer>
+}
+
+export function featureGroup(xs?: Layer[]): FeatureGroup
+
+// Layer
+
+export interface Layer {
+ addEventListener: (name: string, fn: (e: MapEvent) => void) => void
+ getLatLng: () => Pos
+ setLatLng: (pos: Pos) => void
+}
+
+export function tileLayer(url: string): Layer
+
+// Marker
+
+export function marker(
+ pos: Pos,
+ options: {
+ draggable: boolean,
+ autoPan: boolean,
+ icon?: Icon,
+ }
+): Layer
+
+// Circle
+
+export function circle(
+ pos: Pos,
+ options: {
+ radius: number,
+ color: string,
+ fillColor: string,
+ },
+): Layer
+
+// Icon
+
+export interface Icon {}
+
+export function divIcon(
+ params: {
+ className: string
+ popupAnchor: number[]
+ html: Element
+ }
+): Icon
+
+// Pos
+
+export interface Pos {
+ lat: number
+ lng: number
+}
+
+// MapEvent
+
+interface MapEvent {
+ originalEvent: MouseEvent
+ latlng: {lat: number, lng: number}
+}