mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-05 01:42:54 +00:00
beginning of map layer control
This commit is contained in:
20
website/src/lib/components/custom-control/CustomControl.ts
Normal file
20
website/src/lib/components/custom-control/CustomControl.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user