Files
gpx.studio/website/src/lib/components/map/custom-control/custom-control.ts
2026-01-30 21:01:24 +01:00

21 lines
478 B
TypeScript

import { type Map, type IControl } from 'maplibre-gl';
export default class CustomControl implements IControl {
_map: Map | undefined;
_container: HTMLElement;
constructor(container: HTMLElement) {
this._container = container;
}
onAdd(map: Map): HTMLElement {
this._map = map;
return this._container;
}
onRemove() {
this._container?.parentNode?.removeChild(this._container);
this._map = undefined;
}
}