2021-06-23 02:15:28 +02:00
|
|
|
import BaseUIElement from "../BaseUIElement";
|
|
|
|
import Loc from "../../Models/Loc";
|
|
|
|
import BaseLayer from "../../Models/BaseLayer";
|
2021-09-21 02:10:42 +02:00
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
2021-09-28 17:30:48 +02:00
|
|
|
import {BBox} from "../../Logic/BBox";
|
2021-09-03 13:48:04 +02:00
|
|
|
|
2021-09-21 02:10:42 +02:00
|
|
|
export interface MinimapOptions {
|
|
|
|
background?: UIEventSource<BaseLayer>,
|
|
|
|
location?: UIEventSource<Loc>,
|
|
|
|
bounds?: UIEventSource<BBox>,
|
|
|
|
allowMoving?: boolean,
|
|
|
|
leafletOptions?: any,
|
|
|
|
attribution?: BaseUIElement | boolean,
|
|
|
|
onFullyLoaded?: (leaflet: L.Map) => void,
|
|
|
|
leafletMap?: UIEventSource<any>,
|
2021-11-21 02:44:35 +01:00
|
|
|
lastClickLocation?: UIEventSource<{ lat: number, lon: number }>,
|
|
|
|
addLayerControl?: boolean | false
|
2021-09-21 02:10:42 +02:00
|
|
|
}
|
|
|
|
|
2021-09-22 05:02:09 +02:00
|
|
|
export interface MinimapObj {
|
2021-11-07 16:34:51 +01:00
|
|
|
readonly leafletMap: UIEventSource<any>,
|
|
|
|
|
|
|
|
installBounds(factor: number | BBox, showRange?: boolean): void
|
|
|
|
|
2021-11-03 00:44:53 +01:00
|
|
|
TakeScreenshot(): Promise<any>;
|
2021-09-22 05:02:09 +02:00
|
|
|
}
|
|
|
|
|
2021-09-21 02:10:42 +02:00
|
|
|
export default class Minimap {
|
|
|
|
/**
|
|
|
|
* A stub implementation. The actual implementation is injected later on, but only in the browser.
|
|
|
|
* importing leaflet crashes node-ts, which is pretty annoying considering the fact that a lot of scripts use it
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a minimap
|
|
|
|
*/
|
2021-09-27 15:38:12 +02:00
|
|
|
public static createMiniMap: (options: MinimapOptions) => (BaseUIElement & MinimapObj) = (_) => {
|
|
|
|
throw "CreateMinimap hasn't been initialized yet. Please call MinimapImplementation.initialize()"
|
|
|
|
}
|
2021-12-12 02:59:24 +01:00
|
|
|
|
|
|
|
private constructor() {
|
|
|
|
}
|
|
|
|
|
2021-09-03 13:48:04 +02:00
|
|
|
|
2021-06-23 02:15:28 +02:00
|
|
|
}
|