mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 16:52:31 +00:00
20 lines
475 B
TypeScript
20 lines
475 B
TypeScript
import { type Map, type IControl } from 'mapbox-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;
|
|
}
|
|
} |