Use declare for leaflet defined fields

This commit is contained in:
James Lyne 2021-08-26 21:40:54 +01:00
parent 7fb843d618
commit ca8142cca8
13 changed files with 33 additions and 37 deletions

View File

@ -18,10 +18,11 @@ import {Map, DomUtil, MapOptions} from 'leaflet';
import LayerManager from "@/leaflet/layer/LayerManager";
export default class LiveAtlasLeafletMap extends Map {
declare _controlCorners: any;
declare _controlContainer?: HTMLElement;
declare _container?: HTMLElement;
private readonly _layerManager: LayerManager;
private _controlCorners: any;
private _controlContainer?: HTMLElement;
private _container?: HTMLElement;
constructor(element: string | HTMLElement, options?: MapOptions) {
super(element, options);

View File

@ -22,8 +22,7 @@ import {watch} from "@vue/runtime-core";
import "@/assets/icons/chat.svg";
export class ChatControl extends Control {
// @ts-ignore
options: ControlOptions
declare options: ControlOptions
constructor(options: ControlOptions) {
super(options);

View File

@ -38,10 +38,9 @@ export interface ClockControlOptions extends ControlOptions {
}
export class ClockControl extends Control {
// @ts-ignore
options: ClockControlOptions;
declare options: ClockControlOptions;
declare _container?: HTMLElement;
private _container?: HTMLElement;
private _sun?: HTMLElement;
private _moon?: HTMLElement;
private _clock?: HTMLElement;

View File

@ -31,10 +31,9 @@ export interface CoordinatesControlOptions extends ControlOptions {
}
export class CoordinatesControl extends Control {
// @ts-ignore
options: CoordinatesControlOptions;
declare options: CoordinatesControlOptions;
declare _map ?: Map;
private _map ?: Map;
private _location?: Coordinate;
private _locationChanged: boolean = false;
private readonly _coordsContainer: HTMLSpanElement;

View File

@ -25,8 +25,7 @@ import {notify} from "@kyvg/vue3-notification";
import {computed} from "@vue/runtime-core";
export class LinkControl extends Control {
// @ts-ignore
options: ControlOptions
declare options: ControlOptions
constructor(options: ControlOptions) {
super(options);

View File

@ -32,15 +32,16 @@ import Layers = Control.Layers;
const store = useStore();
export class LiveAtlasLayerControl extends Control.Layers {
declare _map ?: LeafletMap;
declare _overlaysList?: HTMLElement;
declare _baseLayersList?: HTMLElement;
declare _layerControlInputs?: HTMLElement[];
declare _container?: HTMLElement;
declare _section?: HTMLElement;
declare _separator?: HTMLElement;
private _layersButton?: HTMLElement;
private _map ?: LeafletMap;
private _overlaysList?: HTMLElement;
private _baseLayersList?: HTMLElement;
private _layerControlInputs?: HTMLElement[];
private _layerPositions: Map<Layer, number>;
private _container?: HTMLElement;
private _section?: HTMLElement;
private _separator?: HTMLElement;
private visible: boolean = false;
constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions) {

View File

@ -38,12 +38,11 @@ export interface LoadingControlOptions extends ControlOptions {
}
export class LoadingControl extends Control {
// @ts-ignore
options: LoadingControlOptions;
declare options: LoadingControlOptions;
_dataLoaders: Set<number> = new Set();
_loadingIndicator: HTMLDivElement;
_delayIndicatorTimeout?: number;
private _dataLoaders: Set<number> = new Set();
private readonly _loadingIndicator: HTMLDivElement;
private _delayIndicatorTimeout?: number;
constructor(options: LoadingControlOptions) {
super(options);

View File

@ -26,8 +26,7 @@ export interface LogoControlOptions extends ControlOptions {
}
export class LogoControl extends Control {
// @ts-ignore
options: LogoControlOptions;
declare options: LogoControlOptions;
constructor(options: LogoControlOptions) {
super(options);

View File

@ -45,8 +45,7 @@ export class GenericIcon extends DivIcon {
className: '',
};
// @ts-ignore
options: GenericIconOptions;
declare options: GenericIconOptions;
private _image?: HTMLImageElement;
private _label?: HTMLSpanElement;

View File

@ -49,6 +49,8 @@ export interface PlayerIconOptions extends MarkerOptions {
}
export class PlayerIcon extends DivIcon {
declare options: PlayerIconOptions;
private readonly _player: LiveAtlasPlayer;
private _container?: HTMLDivElement;
private _playerImage?: HTMLImageElement;
@ -62,9 +64,6 @@ export class PlayerIcon extends DivIcon {
private _playerArmor?: HTMLDivElement;
private _playerArmorBar?: HTMLDivElement;
// @ts-ignore
options: PlayerIconOptions;
constructor(player: LiveAtlasPlayer, options: PlayerIconOptions) {
super(options);
this._player = player;

View File

@ -28,11 +28,11 @@ export interface LiveAtlasLayerGroupOptions extends LayerOptions {
}
export default class LiveAtlasLayerGroup extends LayerGroup {
// @ts-ignore
options: LiveAtlasLayerGroupOptions;
declare options: LiveAtlasLayerGroupOptions;
declare _layers: any;
private _zoomLimitedLayers: Set<Layer>; //Layers which are zoom limited and should be checked on zoom
_layers: any;
_markerPane?: HTMLElement;
private _markerPane?: HTMLElement;
private _zoomEndCallback = () => this._updateLayerVisibility();

View File

@ -26,6 +26,8 @@ export interface PlayerMarkerOptions extends MarkerOptions {
}
export class PlayerMarker extends Marker {
declare options: PlayerMarkerOptions;
private _player: LiveAtlasPlayer;
constructor(player: LiveAtlasPlayer, options: PlayerMarkerOptions) {

View File

@ -26,9 +26,9 @@ export interface LiveAtlasTileLayerOptions extends TileLayerOptions {
// noinspection JSUnusedGlobalSymbols
export abstract class LiveAtlasTileLayer extends TileLayer {
protected _mapSettings: LiveAtlasMapDefinition;
declare options: LiveAtlasTileLayerOptions;
protected _mapSettings: LiveAtlasMapDefinition;
private readonly tileTemplate: LiveAtlasTileElement;
protected readonly loadQueue: LiveAtlasTileElement[] = [];
private readonly loadingTiles: Set<LiveAtlasTileElement> = Object.seal(new Set());