mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-11 10:59:55 +08:00
Updated leaflet typings to match v1.2.x and to use newer typescript features
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as L from 'esri-leaflet-geocoder';
|
||||
import * as L from 'leaflet';
|
||||
import 'esri-leaflet-geocoder';
|
||||
|
||||
const map = L.map('map').setView([45.5165, -122.6764], 12);
|
||||
const tiles = L.esri.basemapLayer("Streets").addTo(map);
|
||||
|
||||
10
types/esri-leaflet-geocoder/index.d.ts
vendored
10
types/esri-leaflet-geocoder/index.d.ts
vendored
@@ -4,13 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import * as leaflet from 'leaflet';
|
||||
import * as esriLeaflet from 'esri-leaflet';
|
||||
import * as L from 'leaflet';
|
||||
import 'esri-leaflet';
|
||||
|
||||
export = L;
|
||||
|
||||
declare global {
|
||||
namespace L.esri.Geocoding {
|
||||
declare module 'leaflet' {
|
||||
namespace esri.Geocoding {
|
||||
type GeosearchConstructor = new (options?: GeosearchObject) => Geosearch;
|
||||
type Geosearch = GeosearchControl & Evented;
|
||||
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
// tslint:disable:only-arrow-functions
|
||||
// tslint:disable:space-before-function-paren
|
||||
|
||||
let latlng: L.LatLng = new L.LatLng(0, 0);
|
||||
let latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng);
|
||||
let map: L.Map = new L.Map('map');
|
||||
import * as L from 'leaflet';
|
||||
import 'esri-leaflet';
|
||||
|
||||
let marker: L.Marker = new L.Marker(latlng);
|
||||
let polygon: L.Polygon = new L.Polygon([latlng, latlng]);
|
||||
let polyline: L.Polyline = new L.Polyline([latlng, latlng]);
|
||||
let geojson: L.GeoJSON = new L.GeoJSON();
|
||||
const latlng: L.LatLng = new L.LatLng(0, 0);
|
||||
const latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng);
|
||||
const map: L.Map = new L.Map('map');
|
||||
|
||||
const marker: L.Marker = new L.Marker(latlng);
|
||||
const polygon: L.Polygon = new L.Polygon([latlng, latlng]);
|
||||
const polyline: L.Polyline = new L.Polyline([latlng, latlng]);
|
||||
const geojson: L.GeoJSON = new L.GeoJSON();
|
||||
|
||||
let basemapLayer: L.esri.BasemapLayer;
|
||||
basemapLayer = L.esri.basemapLayer('Streets');
|
||||
|
||||
13
types/esri-leaflet/index.d.ts
vendored
13
types/esri-leaflet/index.d.ts
vendored
@@ -2,10 +2,11 @@
|
||||
// Project: http://esri.github.io/esri-leaflet
|
||||
// Definitions by: strajuser <https://github.com/strajuser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace esri {
|
||||
type CallbackHandler = (error: any, metadata: any) => void;
|
||||
|
||||
@@ -834,11 +835,7 @@ declare namespace L {
|
||||
* @returns {FeatureLayer}
|
||||
*/
|
||||
function featureLayer(options: FeatureLayerOptions): FeatureLayer;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace L {
|
||||
namespace esri {
|
||||
type FeatureCallbackHandler = (error?: any, featureCollection?: any, response?: any) => void;
|
||||
type ResponseCallbackHandler = (error?: any, response?: any) => void;
|
||||
|
||||
@@ -1621,7 +1618,3 @@ declare namespace L {
|
||||
function find(options: FindOptions | MapService): Find;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'esri-leaflet' {
|
||||
export = L.esri;
|
||||
}
|
||||
|
||||
4
types/leaflet-areaselect/index.d.ts
vendored
4
types/leaflet-areaselect/index.d.ts
vendored
@@ -3,9 +3,9 @@
|
||||
// Definitions by: André Wallat <https://github.com/awallat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
function areaSelect(box: AreaSelectOptions): AreaSelect;
|
||||
|
||||
interface AreaSelectOptions {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-areaselect';
|
||||
|
||||
const map = L.map('map', {center: L.latLng(-37.7772, 175.2756), zoom: 15 });
|
||||
let area: L.AreaSelect;
|
||||
let dim: L.Dimension = { width: 1, height: 2 };
|
||||
const dim: L.Dimension = { width: 1, height: 2 };
|
||||
|
||||
area = L.areaSelect({});
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
{"extends": "dtslint/dt.json"}
|
||||
|
||||
8
types/leaflet-curve/index.d.ts
vendored
8
types/leaflet-curve/index.d.ts
vendored
@@ -1,13 +1,13 @@
|
||||
// Type definitions for leaflet-curve 0.0.1
|
||||
// Type definitions for leaflet-curve 0.1
|
||||
// Project: https://github.com/onikiienko/Leaflet.curve
|
||||
// Definitions by: Onikiienko <https://github.com/onikiienko>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
/**
|
||||
* Drawing Bezier curves and other complex shapes.
|
||||
*/
|
||||
function curve(path: any[], options?: L.PathOptions): Path;
|
||||
function curve(path: any[], options?: PathOptions): Path;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
|
||||
map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 }),
|
||||
objectToSetOnMap = {
|
||||
"color": "black",
|
||||
start: {
|
||||
x: 37.64903402157866,
|
||||
y: -3.6474609375000004
|
||||
},
|
||||
vertex: {
|
||||
x: 38.839707613545144,
|
||||
y: -1.9555664062500002
|
||||
},
|
||||
end: {
|
||||
x: 39.977120098439634,
|
||||
y: -3.6474609375000004
|
||||
}
|
||||
};
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-curve';
|
||||
|
||||
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
||||
const map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
|
||||
const objectToSetOnMap = {
|
||||
color: 'black',
|
||||
start: {
|
||||
x: 37.64903402157866,
|
||||
y: -3.6474609375000004
|
||||
},
|
||||
vertex: {
|
||||
x: 38.839707613545144,
|
||||
y: -1.9555664062500002
|
||||
},
|
||||
end: {
|
||||
x: 39.977120098439634,
|
||||
y: -3.6474609375000004
|
||||
}
|
||||
};
|
||||
|
||||
L.curve(
|
||||
[
|
||||
'M',[objectToSetOnMap.start.x, objectToSetOnMap.start.y],
|
||||
'C',[objectToSetOnMap.start.x, objectToSetOnMap.start.y], [objectToSetOnMap.vertex.x, objectToSetOnMap.vertex.y], [objectToSetOnMap.end.x, objectToSetOnMap.end.y],
|
||||
'T',[objectToSetOnMap.end.x, objectToSetOnMap.end.y]
|
||||
'M', [objectToSetOnMap.start.x, objectToSetOnMap.start.y],
|
||||
'C', [objectToSetOnMap.start.x, objectToSetOnMap.start.y], [objectToSetOnMap.vertex.x, objectToSetOnMap.vertex.y], [objectToSetOnMap.end.x, objectToSetOnMap.end.y],
|
||||
'T', [objectToSetOnMap.end.x, objectToSetOnMap.end.y]
|
||||
],
|
||||
{color: objectToSetOnMap.color}
|
||||
).addTo(map);
|
||||
|
||||
1
types/leaflet-curve/tslint.json
Normal file
1
types/leaflet-curve/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
5
types/leaflet-draw/index.d.ts
vendored
5
types/leaflet-draw/index.d.ts
vendored
@@ -2,10 +2,11 @@
|
||||
// Project: https://github.com/Leaflet/Leaflet.draw
|
||||
// Definitions by: Matt Guest <https://github.com/matt-guest>, Ryan Blace <https://github.com/reblace>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
interface MapOptions {
|
||||
drawControl?: boolean;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-draw';
|
||||
|
||||
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
||||
@@ -42,8 +45,8 @@ map.on(L.Draw.Event.CREATED, (e: L.DrawEvents.Created) => {
|
||||
drawnItems.addLayer(layer);
|
||||
});
|
||||
|
||||
let examplePolygon: L.LatLngLiteral[] = [{lng: 0, lat: 0}, {lng: 10, lat: 0}, {lng: 10, lat: 10}, {lng: 0, lat: 10}, {lng: 0, lat: 0}];
|
||||
let examplePolygonArea: number = L.GeometryUtil.geodesicArea(examplePolygon);
|
||||
const examplePolygon: L.LatLngLiteral[] = [{lng: 0, lat: 0}, {lng: 10, lat: 0}, {lng: 10, lat: 10}, {lng: 0, lat: 10}, {lng: 0, lat: 0}];
|
||||
const examplePolygonArea: number = L.GeometryUtil.geodesicArea(examplePolygon);
|
||||
L.GeometryUtil.readableArea(examplePolygonArea, true);
|
||||
|
||||
function testBooleanControlOptions() {
|
||||
@@ -104,7 +107,7 @@ function testExampleControlOptions() {
|
||||
circle: false, // Turns off this drawing tool
|
||||
rectangle: {
|
||||
shapeOptions: {
|
||||
clickable: false
|
||||
// clickable: false // clickabkle is not a polyline option according to leaflet docs
|
||||
}
|
||||
},
|
||||
marker: {
|
||||
|
||||
74
types/leaflet-editable/index.d.ts
vendored
74
types/leaflet-editable/index.d.ts
vendored
@@ -2,38 +2,39 @@
|
||||
// Project: https://github.com/yohanboniface/Leaflet.Editable
|
||||
// Definitions by: Dominic Alie <https://github.com/dalie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as Leaflet from 'leaflet';
|
||||
|
||||
declare global { namespace L {
|
||||
declare module 'leaflet' {
|
||||
/**
|
||||
* Make geometries editable in Leaflet.
|
||||
*
|
||||
* This is not a plug and play UI, and will not. This is a minimal, lightweight, and fully extendable API to
|
||||
* control editing of geometries. So you can easily build your own UI with your own needs and choices.
|
||||
*/
|
||||
export interface EditableStatic {
|
||||
interface EditableStatic {
|
||||
new (map: Map, options: EditOptions): Editable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to pass to L.Editable when instanciating.
|
||||
*/
|
||||
export interface EditOptions {
|
||||
interface EditOptions {
|
||||
/**
|
||||
* Class to be used when creating a new Polyline.
|
||||
*/
|
||||
polylineClass?: Object;
|
||||
polylineClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used when creating a new Polygon.
|
||||
*/
|
||||
polygonClass?: Object;
|
||||
polygonClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used when creating a new Marker.
|
||||
*/
|
||||
markerClass?: Object;
|
||||
markerClass?: object;
|
||||
|
||||
/**
|
||||
* CSS class to be added to the map container while drawing.
|
||||
@@ -43,42 +44,42 @@ declare global { namespace L {
|
||||
/**
|
||||
* Layer used to store edit tools (vertex, line guide…).
|
||||
*/
|
||||
editLayer?: Leaflet.LayerGroup<Leaflet.ILayer>;
|
||||
editLayer?: LayerGroup<ILayer>;
|
||||
|
||||
/**
|
||||
* Default layer used to store drawn features (marker, polyline…).
|
||||
*/
|
||||
featuresLayer?: Leaflet.LayerGroup<L.Polyline|L.Polygon|L.Marker>;
|
||||
featuresLayer?: LayerGroup<Polyline|Polygon|Marker>;
|
||||
|
||||
/**
|
||||
* Class to be used as vertex, for path editing.
|
||||
*/
|
||||
vertexMarkerClass?: Object;
|
||||
vertexMarkerClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used as middle vertex, pulled by the user to create a new point in the middle of a path.
|
||||
*/
|
||||
middleMarkerClass?: Object;
|
||||
middleMarkerClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used as Polyline editor.
|
||||
*/
|
||||
polylineEditorClass?: Object;
|
||||
polylineEditorClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used as Polygon editor.
|
||||
*/
|
||||
polygonEditorClass?: Object;
|
||||
polygonEditorClass?: object;
|
||||
|
||||
/**
|
||||
* Class to be used as Marker editor.
|
||||
*/
|
||||
markerEditorClass?: Object;
|
||||
markerEditorClass?: object;
|
||||
|
||||
/**
|
||||
* Options to be passed to the line guides.
|
||||
*/
|
||||
lineGuideOptions?: Object;
|
||||
lineGuideOptions?: object;
|
||||
|
||||
/**
|
||||
* Set this to true if you don't want middle markers.
|
||||
@@ -92,7 +93,7 @@ declare global { namespace L {
|
||||
* This is not a plug and play UI, and will not. This is a minimal, lightweight, and fully extendable API to
|
||||
* control editing of geometries. So you can easily build your own UI with your own needs and choices.
|
||||
*/
|
||||
export interface Editable extends Mixin.LeafletMixinEvents {
|
||||
interface Editable extends Mixin.LeafletMixinEvents {
|
||||
/**
|
||||
* Options to pass to L.Editable when instanciating.
|
||||
*/
|
||||
@@ -104,20 +105,20 @@ declare global { namespace L {
|
||||
* Start drawing a polyline. If latlng is given, a first point will be added. In any case, continuing on user
|
||||
* click. If options is given, it will be passed to the polyline class constructor.
|
||||
*/
|
||||
startPolyline(latLng?: LatLng, options?: Leaflet.PolylineOptions): L.Polyline;
|
||||
startPolyline(latLng?: LatLng, options?: PolylineOptions): Polyline;
|
||||
|
||||
/**
|
||||
* Start drawing a polygon. If latlng is given, a first point will be added. In any case, continuing on user
|
||||
* click. If options is given, it will be passed to the polygon class constructor.
|
||||
*/
|
||||
startPolygon(latLng?: LatLng, options?: Leaflet.PolylineOptions): L.Polygon;
|
||||
startPolygon(latLng?: LatLng, options?: PolylineOptions): Polygon;
|
||||
|
||||
/**
|
||||
* Start adding a marker. If latlng is given, the marker will be shown first at this point. In any case, it
|
||||
* will follow the user mouse, and will have a final latlng on next click (or touch). If options is given,
|
||||
* it will be passed to the marker class constructor.
|
||||
*/
|
||||
startMarker(latLng?: LatLng, options?: Leaflet.MarkerOptions): L.Marker;
|
||||
startMarker(latLng?: LatLng, options?: MarkerOptions): Marker;
|
||||
|
||||
/**
|
||||
* When you need to stop any ongoing drawing, without needing to know which editor is active.
|
||||
@@ -125,14 +126,14 @@ declare global { namespace L {
|
||||
stopDrawing(): void;
|
||||
}
|
||||
|
||||
export var Editable: EditableStatic;
|
||||
let Editable: EditableStatic;
|
||||
|
||||
/**
|
||||
* EditableMixin is included to L.Polyline, L.Polygon and L.Marker. It adds the following methods to them.
|
||||
*
|
||||
* When editing is enabled, the editor is accessible on the instance with the editor property.
|
||||
*/
|
||||
export interface EditableMixin {
|
||||
interface EditableMixin {
|
||||
/**
|
||||
* Enable editing, by creating an editor if not existing, and then calling enable on it.
|
||||
*/
|
||||
@@ -154,7 +155,7 @@ declare global { namespace L {
|
||||
editEnabled(): boolean;
|
||||
}
|
||||
|
||||
export interface Map {
|
||||
interface Map {
|
||||
/**
|
||||
* Whether to create a L.Editable instance at map init or not.
|
||||
*/
|
||||
@@ -171,11 +172,11 @@ declare global { namespace L {
|
||||
editTools: Editable;
|
||||
}
|
||||
|
||||
export interface Polyline extends EditableMixin {
|
||||
}
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface Polyline extends EditableMixin {}
|
||||
|
||||
namespace Map {
|
||||
export interface MapOptions {
|
||||
interface MapOptions {
|
||||
/**
|
||||
* Whether to create a L.Editable instance at map init or not.
|
||||
*/
|
||||
@@ -192,7 +193,7 @@ declare global { namespace L {
|
||||
* When editing a feature (marker, polyline…), an editor is attached to it. This editor basically knows
|
||||
* how to handle the edition.
|
||||
*/
|
||||
export interface BaseEditor {
|
||||
interface BaseEditor {
|
||||
/**
|
||||
* Set up the drawing tools for the feature to be editable.
|
||||
*/
|
||||
@@ -208,7 +209,7 @@ declare global { namespace L {
|
||||
* Inherit from L.Editable.BaseEditor.
|
||||
* Inherited by L.Editable.PolylineEditor and L.Editable.PolygonEditor.
|
||||
*/
|
||||
export interface PathEditor extends BaseEditor {
|
||||
interface PathEditor extends BaseEditor {
|
||||
/**
|
||||
* Rebuild edit elements (vertex, middlemarker, etc.).
|
||||
*/
|
||||
@@ -218,7 +219,7 @@ declare global { namespace L {
|
||||
/**
|
||||
* Inherit from L.Editable.PathEditor.
|
||||
*/
|
||||
export interface PolylineEditor extends PathEditor {
|
||||
interface PolylineEditor extends PathEditor {
|
||||
/**
|
||||
* Set up drawing tools to continue the line forward.
|
||||
*/
|
||||
@@ -233,7 +234,7 @@ declare global { namespace L {
|
||||
/**
|
||||
* Inherit from L.Editable.PathEditor.
|
||||
*/
|
||||
export interface PolygonEditor extends PathEditor {
|
||||
interface PolygonEditor extends PathEditor {
|
||||
/**
|
||||
* Set up drawing tools for creating a new hole on the polygon. If the latlng param is given, a first
|
||||
* point is created.
|
||||
@@ -244,15 +245,12 @@ declare global { namespace L {
|
||||
/**
|
||||
* Inherit from L.Editable.BaseEditor.
|
||||
*/
|
||||
export interface MarkerEditor extends BaseEditor {
|
||||
}
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface MarkerEditor extends BaseEditor {}
|
||||
|
||||
export interface Marker extends EditableMixin, MarkerEditor {
|
||||
}
|
||||
interface Marker extends EditableMixin, MarkerEditor {}
|
||||
|
||||
export interface Polyline extends EditableMixin, PolylineEditor {
|
||||
}
|
||||
interface Polyline extends EditableMixin, PolylineEditor {}
|
||||
|
||||
export interface Polygon extends EditableMixin, PolygonEditor {
|
||||
}
|
||||
} }
|
||||
interface Polygon extends EditableMixin, PolygonEditor {}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-editable';
|
||||
|
||||
class MarkerClass { }
|
||||
class MarkerEditorClass { }
|
||||
class MiddleMarkerClass { }
|
||||
@@ -7,7 +10,7 @@ class PolylineClass { }
|
||||
class PolylineEditorClass { }
|
||||
class VertexMarkerClass { }
|
||||
|
||||
var map: L.Map = L.map('div', {
|
||||
const map: L.Map = L.map('div', {
|
||||
editable: true,
|
||||
editOptions: {
|
||||
drawingCSSClass: 'css-class',
|
||||
@@ -26,16 +29,16 @@ var map: L.Map = L.map('div', {
|
||||
}
|
||||
});
|
||||
|
||||
var currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon;
|
||||
const currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon;
|
||||
map.editTools.stopDrawing();
|
||||
|
||||
var marker: L.Marker = map.editTools.startMarker(L.latLng(0, 0), { draggable: true });
|
||||
const marker: L.Marker = map.editTools.startMarker(L.latLng(0, 0), { draggable: true });
|
||||
marker.disable();
|
||||
marker.enable();
|
||||
marker.toggleEdit();
|
||||
var enabled: boolean = marker.editEnabled();
|
||||
let enabled: boolean = marker.editEnabled();
|
||||
|
||||
var polyline: L.Polyline = map.editTools.startPolyline(L.latLng(0, 0), { noClip: true });
|
||||
const polyline: L.Polyline = map.editTools.startPolyline(L.latLng(0, 0), { noClip: true });
|
||||
polyline.continueBackward();
|
||||
polyline.continueForward();
|
||||
polyline.disable();
|
||||
@@ -44,7 +47,7 @@ enabled = polyline.editEnabled();
|
||||
polyline.reset();
|
||||
polyline.toggleEdit();
|
||||
|
||||
var polygon: L.Polygon = map.editTools.startPolygon(L.latLng(0, 0), { noClip: true });
|
||||
const polygon: L.Polygon = map.editTools.startPolygon(L.latLng(0, 0), { noClip: true });
|
||||
polygon.continueBackward();
|
||||
polygon.continueForward();
|
||||
polygon.disable();
|
||||
|
||||
1
types/leaflet-editable/tslint.json
Normal file
1
types/leaflet-editable/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
4
types/leaflet-fullscreen/index.d.ts
vendored
4
types/leaflet-fullscreen/index.d.ts
vendored
@@ -3,9 +3,9 @@
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
interface MapOptions {
|
||||
fullscreenControl?: true | {pseudoFullscreen: boolean};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as L from 'leaflet';
|
||||
|
||||
const map = L.map('map', {
|
||||
center: [51.505, -0.09],
|
||||
zoom: 13,
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
{"extends": "dtslint/dt.json"}
|
||||
|
||||
34
types/leaflet-geocoder-mapzen/index.d.ts
vendored
34
types/leaflet-geocoder-mapzen/index.d.ts
vendored
@@ -1,23 +1,24 @@
|
||||
// Type definitions for leaflet-geocoder-mapzen v1.6.3
|
||||
// Type definitions for leaflet-geocoder-mapzen 1.6
|
||||
// Project: https://github.com/mapzen/leaflet-geocoder
|
||||
// Definitions by: Leonard Lausen <http://leonard.lausen.nl/>
|
||||
// Definitions by: Leonard Lausen <https://github.com/leezu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare global { namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace Control {
|
||||
export interface GeocoderStatic extends Leaflet.ClassStatic {
|
||||
interface GeocoderStatic extends ClassStatic {
|
||||
/**
|
||||
* Creates a geocoder control.
|
||||
*/
|
||||
new (options?: GeocoderOptions): Geocoder;
|
||||
}
|
||||
|
||||
export interface Geocoder extends Leaflet.Control {
|
||||
}
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface Geocoder extends Control {}
|
||||
|
||||
export interface GeocoderOptions {
|
||||
interface GeocoderOptions {
|
||||
/**
|
||||
* Host endpoint for a Pelias-compatible search API.
|
||||
*
|
||||
@@ -32,7 +33,7 @@ declare global { namespace L {
|
||||
*
|
||||
* Default value: false.
|
||||
*/
|
||||
bounds?: Leaflet.LatLngBounds | boolean;
|
||||
bounds?: LatLngBounds | boolean;
|
||||
|
||||
/**
|
||||
* If true, search and autocomplete prioritizes results near the center
|
||||
@@ -42,7 +43,7 @@ declare global { namespace L {
|
||||
*
|
||||
* Default value: 'true'.
|
||||
*/
|
||||
focus?: Leaflet.LatLng | boolean;
|
||||
focus?: LatLng | boolean;
|
||||
|
||||
/**
|
||||
* Filters results by layers (documentation).
|
||||
@@ -69,7 +70,7 @@ declare global { namespace L {
|
||||
*
|
||||
* Default value: null.
|
||||
*/
|
||||
params?: Object;
|
||||
params?: object;
|
||||
|
||||
/**
|
||||
* The position of the control (one of the map corners).
|
||||
@@ -77,7 +78,7 @@ declare global { namespace L {
|
||||
*
|
||||
* Default value: 'topleft'.
|
||||
*/
|
||||
position?: Leaflet.PositionString;
|
||||
position?: PositionString;
|
||||
|
||||
/**
|
||||
* Attribution text to include.
|
||||
@@ -126,7 +127,7 @@ declare global { namespace L {
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
markers?: Leaflet.MarkerOptions | boolean;
|
||||
markers?: MarkerOptions | boolean;
|
||||
|
||||
/**
|
||||
* If true, the input box will expand to take up the full width of the map container.
|
||||
@@ -166,11 +167,10 @@ declare global { namespace L {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace control {
|
||||
|
||||
namespace control {
|
||||
/**
|
||||
* Creates a geocoder control.
|
||||
*/
|
||||
export function geocoder(api_key: string, options?: Control.GeocoderOptions): L.Control.Geocoder;
|
||||
function geocoder(api_key: string, options?: Control.GeocoderOptions): Control.Geocoder;
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
|
||||
map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-geocoder-mapzen';
|
||||
|
||||
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
||||
const map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
|
||||
|
||||
// Add geocoding plugin
|
||||
L.control.geocoder('search-MKZrG6M').addTo(map);
|
||||
|
||||
1
types/leaflet-geocoder-mapzen/tslint.json
Normal file
1
types/leaflet-geocoder-mapzen/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -3,11 +3,11 @@
|
||||
// Definitions by: Thomas Kleinke <https://github.com/tkleinke>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace ImageOverlay {
|
||||
interface Rotated extends L.ImageOverlay {
|
||||
interface Rotated extends ImageOverlay {
|
||||
reposition(
|
||||
topleft: LatLngExpression,
|
||||
topright: LatLngExpression,
|
||||
@@ -21,6 +21,6 @@ declare namespace L {
|
||||
topleft: LatLngExpression,
|
||||
topright: LatLngExpression,
|
||||
bottomleft: LatLngExpression,
|
||||
options?: ImageOverlayOptions): L.ImageOverlay.Rotated;
|
||||
options?: ImageOverlayOptions): ImageOverlay.Rotated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-imageoverlay-rotated';
|
||||
|
||||
const topleft = L.latLng(40.52256691873593, -3.7743186950683594);
|
||||
const topright = L.latLng(40.5210255066156, -3.7734764814376835);
|
||||
const bottomleft = L.latLng(40.52180437272552, -3.7768453359603886);
|
||||
|
||||
130
types/leaflet-label/index.d.ts
vendored
130
types/leaflet-label/index.d.ts
vendored
@@ -3,83 +3,79 @@
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare global {
|
||||
namespace L {
|
||||
interface IconOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
declare module 'leaflet' {
|
||||
interface IconOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
|
||||
interface PathOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
interface PathOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
|
||||
interface CircleMarkerOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
interface CircleMarkerOptions {
|
||||
labelAnchor?: Point;
|
||||
}
|
||||
|
||||
interface Marker {
|
||||
showLabel(): Marker;
|
||||
hideLabel(): Marker;
|
||||
setLabelNoHide(noHide: boolean): void;
|
||||
bindLabel(content: string, options?: LabelOptions): Marker;
|
||||
unbindLabel(): Marker;
|
||||
updateLabelContent(content: string): void;
|
||||
getLabel(): Label;
|
||||
setOpacity(opacity: number, labelHasSemiTransparency: boolean): void;
|
||||
}
|
||||
interface Marker {
|
||||
showLabel(): Marker;
|
||||
hideLabel(): Marker;
|
||||
setLabelNoHide(noHide: boolean): void;
|
||||
bindLabel(content: string, options?: LabelOptions): Marker;
|
||||
unbindLabel(): Marker;
|
||||
updateLabelContent(content: string): void;
|
||||
getLabel(): Label;
|
||||
setOpacity(opacity: number, labelHasSemiTransparency: boolean): void;
|
||||
}
|
||||
|
||||
interface CircleMarker {
|
||||
showLabel(): CircleMarker;
|
||||
hideLabel(): CircleMarker;
|
||||
setLabelNoHide(noHide: boolean): void;
|
||||
bindLabel(content: string, options?: LabelOptions): CircleMarker;
|
||||
unbindLabel(): CircleMarker;
|
||||
updateLabelContent(content: string): void;
|
||||
getLabel(): Label;
|
||||
}
|
||||
interface CircleMarker {
|
||||
showLabel(): CircleMarker;
|
||||
hideLabel(): CircleMarker;
|
||||
setLabelNoHide(noHide: boolean): void;
|
||||
bindLabel(content: string, options?: LabelOptions): CircleMarker;
|
||||
unbindLabel(): CircleMarker;
|
||||
updateLabelContent(content: string): void;
|
||||
getLabel(): Label;
|
||||
}
|
||||
|
||||
interface FeatureGroup<T extends ILayer> {
|
||||
clearLayers(): FeatureGroup<T>;
|
||||
bindLabel(content: string, options?: LabelOptions): FeatureGroup<T>;
|
||||
unbindLabel(): FeatureGroup<T>;
|
||||
updateLabelContent(content: string): FeatureGroup<T>;
|
||||
}
|
||||
interface FeatureGroup<T extends ILayer> {
|
||||
clearLayers(): FeatureGroup<T>;
|
||||
bindLabel(content: string, options?: LabelOptions): FeatureGroup<T>;
|
||||
unbindLabel(): FeatureGroup<T>;
|
||||
updateLabelContent(content: string): FeatureGroup<T>;
|
||||
}
|
||||
|
||||
interface Path {
|
||||
bindLabel(content: string, options?: LabelOptions): Path;
|
||||
unbindLabel(): Path;
|
||||
updateLabelContent(content: string): void;
|
||||
}
|
||||
interface Path {
|
||||
bindLabel(content: string, options?: LabelOptions): Path;
|
||||
unbindLabel(): Path;
|
||||
updateLabelContent(content: string): void;
|
||||
}
|
||||
|
||||
interface LabelOptions {
|
||||
className?: string;
|
||||
clickable?: boolean;
|
||||
direction?: string; // 'left' | 'right' | 'auto';
|
||||
pane?: string;
|
||||
noHide?: boolean;
|
||||
offset?: Point;
|
||||
opacity?: number;
|
||||
zoomAnimation?: boolean;
|
||||
}
|
||||
interface LabelOptions {
|
||||
className?: string;
|
||||
clickable?: boolean;
|
||||
direction?: string; // 'left' | 'right' | 'auto';
|
||||
pane?: string;
|
||||
noHide?: boolean;
|
||||
offset?: Point;
|
||||
opacity?: number;
|
||||
zoomAnimation?: boolean;
|
||||
}
|
||||
|
||||
interface LabelStatic extends ClassStatic {
|
||||
new(options?: LabelOptions): Label;
|
||||
}
|
||||
interface LabelStatic extends ClassStatic {
|
||||
new(options?: LabelOptions): Label;
|
||||
}
|
||||
|
||||
const Label: LabelStatic;
|
||||
const Label: LabelStatic;
|
||||
|
||||
interface Label extends IEventPowered<Label> {
|
||||
onAdd(map: Map): void;
|
||||
onRemove(map: Map): void;
|
||||
setLatLng(latlng: LatLng): Label;
|
||||
setContent(content: string): Label;
|
||||
close(): void;
|
||||
updateZIndex(zIndex: number): void;
|
||||
setOpacity(opacity: number): void;
|
||||
}
|
||||
interface Label extends IEventPowered<Label> {
|
||||
onAdd(map: Map): void;
|
||||
onRemove(map: Map): void;
|
||||
setLatLng(latlng: LatLng): Label;
|
||||
setContent(content: string): Label;
|
||||
close(): void;
|
||||
updateZIndex(zIndex: number): void;
|
||||
setOpacity(opacity: number): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = L;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
let map: L.Map;
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-label';
|
||||
|
||||
const map: L.Map = L.map('map-container');
|
||||
let label: L.Label;
|
||||
|
||||
// Icon
|
||||
|
||||
5
types/leaflet-polylinedecorator/index.d.ts
vendored
5
types/leaflet-polylinedecorator/index.d.ts
vendored
@@ -2,10 +2,11 @@
|
||||
// Project: https://github.com/bbecquet/Leaflet.PolylineDecorator#readme
|
||||
// Definitions by: Viktor Soucek <https://github.com/soucekv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace Symbol {
|
||||
interface DashOptions {
|
||||
pixelSize?: number;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-polylinedecorator';
|
||||
|
||||
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
||||
|
||||
6
types/leaflet-providers/index.d.ts
vendored
6
types/leaflet-providers/index.d.ts
vendored
@@ -3,9 +3,9 @@
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace TileLayer {
|
||||
class Provider extends TileLayer {
|
||||
constructor(provider: string, options?: TileLayerOptions)
|
||||
@@ -21,7 +21,7 @@ declare namespace L {
|
||||
interface ProviderConfig {
|
||||
url: string;
|
||||
options?: TileLayerOptions;
|
||||
variants?: { [variantName: string]: string | ProviderConfig };
|
||||
variants?: {[variantName: string]: string | ProviderConfig};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-providers';
|
||||
|
||||
const map = L.map('map');
|
||||
L.tileLayer.provider('Stamen.Watercolor').addTo(map);
|
||||
|
||||
|
||||
50
types/leaflet.awesome-markers/index.d.ts
vendored
50
types/leaflet.awesome-markers/index.d.ts
vendored
@@ -1,51 +1,51 @@
|
||||
// Type definitions for Leaflet.awesome-markers plugin v2.0
|
||||
// Type definitions for Leaflet.awesome-markers plugin 2.0
|
||||
// Project: https://github.com/sigma-geosistemas/Leaflet.awesome-markers#properties
|
||||
// Definitions by: Marcel Sebek <https://github.com/sebek64>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
|
||||
declare global { namespace L {
|
||||
module AwesomeMarkers {
|
||||
var version: string;
|
||||
declare module 'leaflet' {
|
||||
namespace AwesomeMarkers {
|
||||
const version: string;
|
||||
|
||||
function icon(options: AwesomeMarkers.IconOptions): AwesomeMarkers.Icon;
|
||||
|
||||
class Icon extends Leaflet.BaseIcon {
|
||||
constructor(options?: AwesomeMarkers.IconOptions);
|
||||
options: AwesomeMarkers.IconOptions;
|
||||
}
|
||||
|
||||
interface IconOptions extends Leaflet.BaseIconOptions {
|
||||
interface AwesomeMarkersIconOptions extends BaseIconOptions {
|
||||
/**
|
||||
* Name of the icon. See glyphicons or font-awesome.
|
||||
*/
|
||||
* Name of the icon. See glyphicons or font-awesome.
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/**
|
||||
* Select de icon library. 'fa' for font-awesome or 'glyphicon' for bootstrap 3.
|
||||
*/
|
||||
* Select de icon library. 'fa' for font-awesome or 'glyphicon' for bootstrap 3.
|
||||
*/
|
||||
prefix?: 'fa' | 'glyphicon';
|
||||
|
||||
/**
|
||||
* Color of the marker
|
||||
*/
|
||||
* Color of the marker
|
||||
*/
|
||||
markerColor?: 'red' | 'darkred' | 'orange' | 'green' | 'darkgreen' | 'blue' | 'purple' | 'darkpurple' | 'cadetblue';
|
||||
|
||||
/**
|
||||
* Color of the icon. 'white', 'black' or css code (hex, rgba etc).
|
||||
*/
|
||||
* Color of the icon. 'white', 'black' or css code (hex, rgba etc).
|
||||
*/
|
||||
iconColor?: 'white' | 'black' | string;
|
||||
|
||||
/**
|
||||
* Make the icon spin. true or false. Font-awesome required
|
||||
*/
|
||||
* Make the icon spin. true or false. Font-awesome required
|
||||
*/
|
||||
spin?: boolean;
|
||||
|
||||
/**
|
||||
* Additional classes in the created tag
|
||||
*/
|
||||
* Additional classes in the created tag
|
||||
*/
|
||||
extraClasses?: string;
|
||||
}
|
||||
|
||||
function icon(options: AwesomeMarkersIconOptions): Icon;
|
||||
|
||||
class Icon extends Leaflet.Icon<AwesomeMarkersIconOptions> {
|
||||
constructor(options?: AwesomeMarkersIconOptions);
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.awesome-markers';
|
||||
|
||||
const map: L.Map = L.map('map-container');
|
||||
|
||||
var map: L.Map;
|
||||
|
||||
var redMarker = L.AwesomeMarkers.icon({
|
||||
const redMarker = L.AwesomeMarkers.icon({
|
||||
icon: 'coffee',
|
||||
markerColor: 'red'
|
||||
});
|
||||
|
||||
var blueMarker = new L.AwesomeMarkers.Icon({
|
||||
const blueMarker = new L.AwesomeMarkers.Icon({
|
||||
icon: 'star',
|
||||
markerColor: 'blue'
|
||||
});
|
||||
|
||||
1
types/leaflet.awesome-markers/tslint.json
Normal file
1
types/leaflet.awesome-markers/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
33
types/leaflet.fullscreen/index.d.ts
vendored
33
types/leaflet.fullscreen/index.d.ts
vendored
@@ -1,35 +1,32 @@
|
||||
// Type definitions for Leaflet.fullscreen v1.3.0
|
||||
// Type definitions for Leaflet.fullscreen 1.3
|
||||
// Project: https://github.com/brunob/leaflet.fullscreen
|
||||
// Definitions by: William Comartin <https://github.com/wcomartin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
|
||||
declare namespace L {
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare module 'leaflet' {
|
||||
namespace Control {
|
||||
|
||||
export class Fullscreen extends L.Control {
|
||||
constructor(options?: Control.FullscreenOptions);
|
||||
class Fullscreen extends L.Control {
|
||||
constructor(options?: FullscreenOptions);
|
||||
options: FullscreenOptions;
|
||||
}
|
||||
export interface FullscreenOptions {
|
||||
content?: string,
|
||||
position?: L.ControlPosition,
|
||||
title?: string,
|
||||
titleCancel?: string,
|
||||
forceSeparateButton?: boolean,
|
||||
forcePseudoFullscreen?: boolean,
|
||||
pseudoFullscreen?:boolean
|
||||
|
||||
interface FullscreenOptions {
|
||||
content?: string;
|
||||
position?: ControlPosition;
|
||||
title?: string;
|
||||
titleCancel?: string;
|
||||
forceSeparateButton?: boolean;
|
||||
forcePseudoFullscreen?: boolean;
|
||||
pseudoFullscreen?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
|
||||
/**
|
||||
* Creates a fullscreen control.
|
||||
*/
|
||||
export function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen;
|
||||
|
||||
function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.fullscreen';
|
||||
|
||||
|
||||
var map: L.Map;
|
||||
const map: L.Map = L.map('map-container');
|
||||
|
||||
// Defaults
|
||||
var icon: L.Control.Fullscreen = L.control.fullscreen({
|
||||
const icon: L.Control.Fullscreen = L.control.fullscreen({
|
||||
position: 'topleft',
|
||||
title: 'Full Screen',
|
||||
titleCancel: 'Exit Full Screen',
|
||||
@@ -13,9 +14,7 @@ var icon: L.Control.Fullscreen = L.control.fullscreen({
|
||||
|
||||
icon.addTo(map);
|
||||
|
||||
|
||||
// My Usage
|
||||
|
||||
L.control.fullscreen({
|
||||
position: 'topleft',
|
||||
content: '<i class="fa fa-arrows-alt"></i>',
|
||||
|
||||
1
types/leaflet.fullscreen/tslint.json
Normal file
1
types/leaflet.fullscreen/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
140
types/leaflet.gridlayer.googlemutant/index.d.ts
vendored
140
types/leaflet.gridlayer.googlemutant/index.d.ts
vendored
@@ -3,75 +3,77 @@
|
||||
// Definitions by: Ernest Rhinozeros <https://github.com/ernest-rhinozeros>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L.gridLayer {
|
||||
interface GoogleMutant extends GridLayer {
|
||||
setElementSize(e: HTMLElement, size: Point): void ;
|
||||
declare module 'leaflet' {
|
||||
namespace gridLayer {
|
||||
interface GoogleMutant extends GridLayer {
|
||||
setElementSize(e: HTMLElement, size: Point): void ;
|
||||
}
|
||||
|
||||
type GoogleMutantType = 'roadmap' | 'satellite' | 'terrain' | 'hybrid';
|
||||
|
||||
interface GoogleMutantStyler {
|
||||
hue?: string;
|
||||
lightness?: number;
|
||||
saturation?: number;
|
||||
gamma?: number;
|
||||
invert_lightness?: boolean;
|
||||
visibility?: string;
|
||||
color?: string;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Google's map style.
|
||||
*
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference
|
||||
*/
|
||||
interface GoogleMutantStyle {
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#style-features
|
||||
*/
|
||||
featureType?: string;
|
||||
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#style-elements
|
||||
*/
|
||||
elementType?: string;
|
||||
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#stylers
|
||||
*/
|
||||
stylers?: GoogleMutantStyler[];
|
||||
}
|
||||
|
||||
interface GoogleMutantOptions extends TileLayerOptions {
|
||||
minZoom?: number;
|
||||
maxZoom?: number;
|
||||
maxNativeZoom?: number;
|
||||
tileSize?: number | Point;
|
||||
subdomains?: string | string[];
|
||||
errorTileUrl?: string;
|
||||
|
||||
/**
|
||||
* The mutant container will add its own attribution anyways.
|
||||
*/
|
||||
attribution?: string;
|
||||
|
||||
opacity?: number;
|
||||
continuousWorld?: boolean;
|
||||
noWrap?: boolean;
|
||||
|
||||
/**
|
||||
* Google's map type. 'hybrid' is not really supported.
|
||||
*/
|
||||
type?: GoogleMutantType;
|
||||
|
||||
/**
|
||||
* Google's map styles.
|
||||
*/
|
||||
styles?: GoogleMutantStyle[];
|
||||
}
|
||||
|
||||
function googleMutant(options?: GoogleMutantOptions): GoogleMutant;
|
||||
}
|
||||
|
||||
type GoogleMutantType = 'roadmap' | 'satellite' | 'terrain' | 'hybrid';
|
||||
|
||||
interface GoogleMutantStyler {
|
||||
hue?: string;
|
||||
lightness?: number;
|
||||
saturation?: number;
|
||||
gamma?: number;
|
||||
invert_lightness?: boolean;
|
||||
visibility?: string;
|
||||
color?: string;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Google's map style.
|
||||
*
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference
|
||||
*/
|
||||
interface GoogleMutantStyle {
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#style-features
|
||||
*/
|
||||
featureType?: string;
|
||||
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#style-elements
|
||||
*/
|
||||
elementType?: string;
|
||||
|
||||
/**
|
||||
* https://developers.google.com/maps/documentation/javascript/style-reference#stylers
|
||||
*/
|
||||
stylers?: GoogleMutantStyler[];
|
||||
}
|
||||
|
||||
interface GoogleMutantOptions extends TileLayerOptions {
|
||||
minZoom?: number;
|
||||
maxZoom?: number;
|
||||
maxNativeZoom?: number;
|
||||
tileSize?: number | Point;
|
||||
subdomains?: string | string[];
|
||||
errorTileUrl?: string;
|
||||
|
||||
/**
|
||||
* The mutant container will add its own attribution anyways.
|
||||
*/
|
||||
attribution?: string;
|
||||
|
||||
opacity?: number;
|
||||
continuousWorld?: boolean;
|
||||
noWrap?: boolean;
|
||||
|
||||
/**
|
||||
* Google's map type. 'hybrid' is not really supported.
|
||||
*/
|
||||
type?: GoogleMutantType;
|
||||
|
||||
/**
|
||||
* Google's map styles.
|
||||
*/
|
||||
styles?: GoogleMutantStyle[];
|
||||
}
|
||||
|
||||
function googleMutant(options?: GoogleMutantOptions): GoogleMutant;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
let map = L.map('foo');
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.gridlayer.googlemutant';
|
||||
|
||||
let roads = L.gridLayer.googleMutant({
|
||||
const map = L.map('foo');
|
||||
|
||||
const roads = L.gridLayer.googleMutant({
|
||||
type: 'roadmap'
|
||||
}).addTo(map);
|
||||
|
||||
let styled = L.gridLayer.googleMutant({
|
||||
const styled = L.gridLayer.googleMutant({
|
||||
type: 'satellite',
|
||||
styles: [
|
||||
{ elementType: 'labels', stylers: [ { visibility: 'off' } ] },
|
||||
|
||||
5
types/leaflet.locatecontrol/index.d.ts
vendored
5
types/leaflet.locatecontrol/index.d.ts
vendored
@@ -3,9 +3,9 @@
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace Control {
|
||||
interface LocateOptions {
|
||||
position?: string;
|
||||
@@ -34,6 +34,7 @@ declare namespace L {
|
||||
locateOptions?: L.LocateOptions;
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
/**
|
||||
* Creates a Leaflet.Locate control
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.locatecontrol';
|
||||
|
||||
const map = L.map('map', {
|
||||
center: [51.505, -0.09],
|
||||
zoom: 13
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
// Project: https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport
|
||||
// Definitions by: AsamK <https://github.com/AsamK>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as MakerCluster from "leaflet.markercluster";
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.markercluster';
|
||||
|
||||
export = Leaflet;
|
||||
|
||||
declare global { namespace L {
|
||||
declare module 'leaflet' {
|
||||
namespace MarkerClusterGroup {
|
||||
interface LayerSupport extends MarkerClusterGroup {
|
||||
/**
|
||||
@@ -38,4 +37,4 @@ declare global { namespace L {
|
||||
*/
|
||||
function layerSupport(options?: MarkerClusterGroupLayerSupportOptions): MarkerClusterGroup.LayerSupport;
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import L = require("leaflet.markercluster.layersupport");
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.markercluster.layersupport';
|
||||
|
||||
const polylineOptions: L.PolylineOptions = {};
|
||||
const icon: L.Icon = L.icon({ iconUrl: 'foo' });
|
||||
|
||||
9
types/leaflet.markercluster/index.d.ts
vendored
9
types/leaflet.markercluster/index.d.ts
vendored
@@ -2,12 +2,11 @@
|
||||
// Project: https://github.com/Leaflet/Leaflet.markercluster
|
||||
// Definitions by: Robert Imig <https://github.com/rimig>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as L from 'leaflet';
|
||||
|
||||
export = Leaflet;
|
||||
|
||||
declare global { namespace L {
|
||||
declare module 'leaflet' {
|
||||
interface MarkerCluster extends Marker {
|
||||
/*
|
||||
* Recursively retrieve all child markers of this cluster.
|
||||
@@ -166,4 +165,4 @@ declare global { namespace L {
|
||||
* Create a marker cluster group, optionally given marker cluster group options.
|
||||
*/
|
||||
function markerClusterGroup(options?: MarkerClusterGroupOptions): MarkerClusterGroup;
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import L = require("leaflet.markercluster");
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.markercluster';
|
||||
|
||||
const polylineOptions: L.PolylineOptions = {};
|
||||
const icon: L.Icon = L.icon({ iconUrl: 'foo' });
|
||||
|
||||
5
types/leaflet.pm/index.d.ts
vendored
5
types/leaflet.pm/index.d.ts
vendored
@@ -2,10 +2,11 @@
|
||||
// Project: https://github.com/codeofsumit/leaflet.pm
|
||||
// Definitions by: Thomas Kleinke <https://github.com/tkleinke>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare namespace L {
|
||||
declare module 'leaflet' {
|
||||
interface Map {
|
||||
pm: PM.Map;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-pm';
|
||||
|
||||
const toolbarOptions: L.PM.ToolbarOptions = {
|
||||
position: 'topleft',
|
||||
drawMarker: true,
|
||||
|
||||
2961
types/leaflet/index.d.ts
vendored
2961
types/leaflet/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import L = require('leaflet');
|
||||
import * as L from 'leaflet';
|
||||
|
||||
const latLngLiteral: L.LatLngLiteral = {lat: 12, lng: 13};
|
||||
const latLngTuple: L.LatLngTuple = [12, 13];
|
||||
@@ -451,8 +451,8 @@ L.marker([1, 2], {
|
||||
}));
|
||||
|
||||
const latLngs = [
|
||||
{ lat: 0, lng: 0 },
|
||||
{ lat: 1, lng: 1 }
|
||||
{lat: 0, lng: 0},
|
||||
{lat: 1, lng: 1}
|
||||
];
|
||||
const polygon = new L.Polygon(latLngs);
|
||||
const polygonExclusion = new L.Polygon([latLngs, latLngs]);
|
||||
|
||||
19
types/proj4leaflet/index.d.ts
vendored
19
types/proj4leaflet/index.d.ts
vendored
@@ -3,11 +3,12 @@
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as proj4 from "proj4";
|
||||
import * as Leaflet from "leaflet";
|
||||
import * as geojson from 'geojson';
|
||||
import * as L from 'leaflet';
|
||||
import * as proj4 from 'proj4';
|
||||
|
||||
declare global {
|
||||
namespace L.Proj {
|
||||
declare module 'leaflet' {
|
||||
namespace Proj {
|
||||
class CRS implements CRS {
|
||||
projection: Projection;
|
||||
transformation: Transformation;
|
||||
@@ -38,13 +39,11 @@ declare global {
|
||||
wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
|
||||
}
|
||||
|
||||
class GeoJSON extends Leaflet.GeoJSON {
|
||||
}
|
||||
class GeoJSON extends L.GeoJSON {}
|
||||
|
||||
const geoJson: (geojson?: GeoJSONGeoJsonObject, options?: GeoJSONOptions) => GeoJSON;
|
||||
const geoJson: (geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions) => GeoJSON;
|
||||
|
||||
class ImageOverlay extends Leaflet.ImageOverlay {
|
||||
}
|
||||
class ImageOverlay extends L.ImageOverlay {}
|
||||
|
||||
const imageOverlay: (imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions) => ImageOverlay;
|
||||
|
||||
@@ -57,5 +56,3 @@ declare global {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = L;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import * as proj4 from "proj4";
|
||||
import * as L from 'leaflet';
|
||||
import 'proj4leaflet';
|
||||
|
||||
import * as proj4 from 'proj4';
|
||||
|
||||
import LatLngBoundsExpression = L.LatLngBoundsExpression;
|
||||
|
||||
const crs = new L.Proj.CRS('EPSG:2400',
|
||||
|
||||
98
types/react-leaflet/index.d.ts
vendored
98
types/react-leaflet/index.d.ts
vendored
@@ -13,31 +13,31 @@ import * as React from 'react';
|
||||
export type Children = React.ReactNode | React.ReactNode[];
|
||||
|
||||
export interface MapEvents {
|
||||
onclick?(event: Leaflet.MouseEvent): void;
|
||||
ondblclick?(event: Leaflet.MouseEvent): void;
|
||||
onmousedown?(event: Leaflet.MouseEvent): void;
|
||||
onmouseup?(event: Leaflet.MouseEvent): void;
|
||||
onmouseover?(event: Leaflet.MouseEvent): void;
|
||||
onmouseout?(event: Leaflet.MouseEvent): void;
|
||||
onmousemove?(event: Leaflet.MouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.MouseEvent): void;
|
||||
onfocus?(event: Leaflet.Event): void;
|
||||
onblur?(event: Leaflet.Event): void;
|
||||
onpreclick?(event: Leaflet.MouseEvent): void;
|
||||
onload?(event: Leaflet.Event): void;
|
||||
onunload?(event: Leaflet.Event): void;
|
||||
onviewreset?(event: Leaflet.Event): void;
|
||||
onmove?(event: Leaflet.Event): void;
|
||||
onmovestart?(event: Leaflet.Event): void;
|
||||
onmoveend?(event: Leaflet.Event): void;
|
||||
ondragstart?(event: Leaflet.Event): void;
|
||||
ondrag?(event: Leaflet.Event): void;
|
||||
onclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
ondblclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmousedown?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseup?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseover?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseout?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmousemove?(event: Leaflet.LeafletMouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onfocus?(event: Leaflet.LeafletEvent): void;
|
||||
onblur?(event: Leaflet.LeafletEvent): void;
|
||||
onpreclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onload?(event: Leaflet.LeafletEvent): void;
|
||||
onunload?(event: Leaflet.LeafletEvent): void;
|
||||
onviewreset?(event: Leaflet.LeafletEvent): void;
|
||||
onmove?(event: Leaflet.LeafletEvent): void;
|
||||
onmovestart?(event: Leaflet.LeafletEvent): void;
|
||||
onmoveend?(event: Leaflet.LeafletEvent): void;
|
||||
ondragstart?(event: Leaflet.LeafletEvent): void;
|
||||
ondrag?(event: Leaflet.LeafletEvent): void;
|
||||
ondragend?(event: Leaflet.DragEndEvent): void;
|
||||
onzoomstart?(event: Leaflet.Event): void;
|
||||
onzoomend?(event: Leaflet.Event): void;
|
||||
onzoomlevelschange?(event: Leaflet.Event): void;
|
||||
onzoomstart?(event: Leaflet.LeafletEvent): void;
|
||||
onzoomend?(event: Leaflet.LeafletEvent): void;
|
||||
onzoomlevelschange?(event: Leaflet.LeafletEvent): void;
|
||||
onresize?(event: Leaflet.ResizeEvent): void;
|
||||
onautopanstart?(event: Leaflet.Event): void;
|
||||
onautopanstart?(event: Leaflet.LeafletEvent): void;
|
||||
onlayeradd?(event: Leaflet.LayerEvent): void;
|
||||
onlayerremove?(event: Leaflet.LayerEvent): void;
|
||||
onbaselayerchange?(event: Leaflet.LayersControlEvent): void;
|
||||
@@ -50,25 +50,25 @@ export interface MapEvents {
|
||||
}
|
||||
|
||||
export interface MarkerEvents {
|
||||
onclick?(event: Leaflet.MouseEvent): void;
|
||||
ondblclick?(event: Leaflet.MouseEvent): void;
|
||||
onmousedown?(event: Leaflet.MouseEvent): void;
|
||||
onmouseover?(event: Leaflet.MouseEvent): void;
|
||||
onmouseout?(event: Leaflet.MouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.MouseEvent): void;
|
||||
ondragstart?(event: Leaflet.Event): void;
|
||||
ondrag?(event: Leaflet.Event): void;
|
||||
onclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
ondblclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmousedown?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseover?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseout?(event: Leaflet.LeafletMouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.LeafletMouseEvent): void;
|
||||
ondragstart?(event: Leaflet.LeafletEvent): void;
|
||||
ondrag?(event: Leaflet.LeafletEvent): void;
|
||||
ondragend?(event: Leaflet.DragEndEvent): void;
|
||||
onmove?(event: Leaflet.Event): void;
|
||||
onadd?(event: Leaflet.Event): void;
|
||||
onremove?(event: Leaflet.Event): void;
|
||||
onmove?(event: Leaflet.LeafletEvent): void;
|
||||
onadd?(event: Leaflet.LeafletEvent): void;
|
||||
onremove?(event: Leaflet.LeafletEvent): void;
|
||||
onpopupopen?(event: Leaflet.PopupEvent): void;
|
||||
onpopupclose?(event: Leaflet.PopupEvent): void;
|
||||
}
|
||||
|
||||
export interface TileLayerEvents {
|
||||
onloading?(event: Leaflet.Event): void;
|
||||
onload?(event: Leaflet.Event): void;
|
||||
onloading?(event: Leaflet.LeafletEvent): void;
|
||||
onload?(event: Leaflet.LeafletEvent): void;
|
||||
ontileloadstart?(event: Leaflet.TileEvent): void;
|
||||
ontileload?(event: Leaflet.TileEvent): void;
|
||||
ontileunload?(event: Leaflet.TileEvent): void;
|
||||
@@ -76,24 +76,24 @@ export interface TileLayerEvents {
|
||||
}
|
||||
|
||||
export interface PathEvents {
|
||||
onclick?(event: Leaflet.MouseEvent): void;
|
||||
ondblclick?(event: Leaflet.MouseEvent): void;
|
||||
onmousedown?(event: Leaflet.MouseEvent): void;
|
||||
onmouseover?(event: Leaflet.MouseEvent): void;
|
||||
onmouseout?(event: Leaflet.MouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.MouseEvent): void;
|
||||
onadd?(event: Leaflet.Event): void;
|
||||
onremove?(event: Leaflet.Event): void;
|
||||
onclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
ondblclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmousedown?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseover?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseout?(event: Leaflet.LeafletMouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onadd?(event: Leaflet.LeafletEvent): void;
|
||||
onremove?(event: Leaflet.LeafletEvent): void;
|
||||
onpopupopen?(event: Leaflet.PopupEvent): void;
|
||||
onpopupclose?(event: Leaflet.PopupEvent): void;
|
||||
}
|
||||
|
||||
export interface FeatureGroupEvents {
|
||||
onclick?(event: Leaflet.MouseEvent): void;
|
||||
ondblclick?(event: Leaflet.MouseEvent): void;
|
||||
onmouseover?(event: Leaflet.MouseEvent): void;
|
||||
onmouseout?(event: Leaflet.MouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.MouseEvent): void;
|
||||
onclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
ondblclick?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseover?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onmouseout?(event: Leaflet.LeafletMouseEvent): void;
|
||||
oncontextmenu?(event: Leaflet.LeafletMouseEvent): void;
|
||||
onlayeradd?(event: Leaflet.LayerEvent): void;
|
||||
onlayerremove?(event: Leaflet.LayerEvent): void;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import * as Leaflet from 'leaflet';
|
||||
import * as L from 'leaflet';
|
||||
import { Component, PropTypes } from 'react';
|
||||
import {
|
||||
Children,
|
||||
@@ -32,7 +32,7 @@ const { BaseLayer, Overlay } = LayersControl;
|
||||
interface AnimateExampleState {
|
||||
animate: boolean;
|
||||
hasLocation: boolean;
|
||||
latlng: Leaflet.LatLngExpression;
|
||||
latlng: L.LatLngExpression;
|
||||
}
|
||||
|
||||
export class AnimateExample extends Component<undefined, AnimateExampleState> {
|
||||
@@ -45,7 +45,7 @@ export class AnimateExample extends Component<undefined, AnimateExampleState> {
|
||||
},
|
||||
};
|
||||
|
||||
handleClick = (e: Leaflet.MouseEvent) => {
|
||||
handleClick = (e: L.LeafletMouseEvent) => {
|
||||
this.setState({
|
||||
latlng: e.latlng,
|
||||
});
|
||||
@@ -96,17 +96,17 @@ export class AnimateExample extends Component<undefined, AnimateExampleState> {
|
||||
}
|
||||
|
||||
// bounds.js
|
||||
const outer: Leaflet.LatLngBoundsLiteral = [
|
||||
const outer: L.LatLngBoundsLiteral = [
|
||||
[50.505, -29.09],
|
||||
[52.505, 29.09],
|
||||
];
|
||||
const inner: Leaflet.LatLngBoundsLiteral = [
|
||||
const inner: L.LatLngBoundsLiteral = [
|
||||
[49.505, -2.09],
|
||||
[53.505, 2.09],
|
||||
];
|
||||
|
||||
interface BoundsExampleState {
|
||||
bounds: Leaflet.LatLngBoundsLiteral;
|
||||
bounds: L.LatLngBoundsLiteral;
|
||||
}
|
||||
|
||||
export class BoundsExample extends Component<undefined, BoundsExampleState> {
|
||||
@@ -147,7 +147,7 @@ export class BoundsExample extends Component<undefined, BoundsExampleState> {
|
||||
// custom-component.js
|
||||
interface MyPopupMarkerProps {
|
||||
children: Children;
|
||||
position: Leaflet.LatLngExpression;
|
||||
position: L.LatLngExpression;
|
||||
}
|
||||
|
||||
interface MyMarker extends MyPopupMarkerProps {
|
||||
@@ -187,7 +187,7 @@ export class CustomComponent extends Component<undefined, CustomComponentState>
|
||||
};
|
||||
|
||||
render() {
|
||||
const center: Leaflet.LatLngExpression = [this.state.lat, this.state.lng];
|
||||
const center: L.LatLngExpression = [this.state.lat, this.state.lng];
|
||||
|
||||
const markers: MyMarker[] = [
|
||||
{ key: 'marker1', position: [51.5, -0.1], children: 'My first popup' },
|
||||
@@ -212,7 +212,7 @@ export class MarkerWithDivIconExample extends Component<undefined, undefined> {
|
||||
return (
|
||||
<Map>
|
||||
<Marker position={[0, 0]} icon={
|
||||
new Leaflet.DivIcon({})
|
||||
new L.DivIcon({})
|
||||
} />
|
||||
</Map>
|
||||
);
|
||||
@@ -221,8 +221,8 @@ export class MarkerWithDivIconExample extends Component<undefined, undefined> {
|
||||
|
||||
// draggable-marker.js
|
||||
interface DraggableExampleState {
|
||||
center: Leaflet.LatLngLiteral;
|
||||
marker: Leaflet.LatLngLiteral;
|
||||
center: L.LatLngLiteral;
|
||||
marker: L.LatLngLiteral;
|
||||
zoom: number;
|
||||
draggable: boolean;
|
||||
}
|
||||
@@ -256,8 +256,8 @@ export class DraggableExample extends Component<undefined, DraggableExampleState
|
||||
}
|
||||
|
||||
render() {
|
||||
const position: Leaflet.LatLngExpression = [this.state.center.lat, this.state.center.lng];
|
||||
const markerPosition: Leaflet.LatLngExpression = [this.state.marker.lat, this.state.marker.lng];
|
||||
const position: L.LatLngExpression = [this.state.center.lat, this.state.center.lng];
|
||||
const markerPosition: L.LatLngExpression = [this.state.marker.lat, this.state.marker.lng];
|
||||
|
||||
return (
|
||||
<Map center={position} zoom={this.state.zoom}>
|
||||
@@ -285,7 +285,7 @@ export class DraggableExample extends Component<undefined, DraggableExampleState
|
||||
// events.js
|
||||
interface EventsExampleState {
|
||||
hasLocation: boolean;
|
||||
latlng: Leaflet.LatLngLiteral;
|
||||
latlng: L.LatLngLiteral;
|
||||
}
|
||||
|
||||
export class EventsExample extends Component<undefined, EventsExampleState> {
|
||||
@@ -301,7 +301,7 @@ export class EventsExample extends Component<undefined, EventsExampleState> {
|
||||
(this.refs.map as Map).leafletElement.locate();
|
||||
}
|
||||
|
||||
handleLocationFound = (e: Leaflet.LocationEvent) => {
|
||||
handleLocationFound = (e: L.LocationEvent) => {
|
||||
this.setState({
|
||||
hasLocation: true,
|
||||
latlng: e.latlng,
|
||||
@@ -339,8 +339,8 @@ export class EventsExample extends Component<undefined, EventsExampleState> {
|
||||
// layers-control.js
|
||||
export class LayersControlExample extends Component<undefined, undefined> {
|
||||
render() {
|
||||
const center: Leaflet.LatLngExpression = [51.505, -0.09];
|
||||
const rectangle: Leaflet.LatLngBoundsExpression = [
|
||||
const center: L.LatLngExpression = [51.505, -0.09];
|
||||
const rectangle: L.LatLngBoundsExpression = [
|
||||
[51.49, -0.08],
|
||||
[51.5, -0.06],
|
||||
];
|
||||
@@ -394,8 +394,8 @@ export class LayersControlExample extends Component<undefined, undefined> {
|
||||
// other-layers.js
|
||||
export class OtherLayersExample extends Component<undefined, undefined> {
|
||||
render() {
|
||||
const center: Leaflet.LatLngExpression = [51.505, -0.09];
|
||||
const rectangle: Leaflet.LatLngBoundsExpression = [
|
||||
const center: L.LatLngExpression = [51.505, -0.09];
|
||||
const rectangle: L.LatLngBoundsExpression = [
|
||||
[51.49, -0.08],
|
||||
[51.5, -0.06],
|
||||
];
|
||||
@@ -481,7 +481,7 @@ export class SimpleExample extends Component<undefined, SimpleExampleState> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const position: Leaflet.LatLngExpression = [this.state.lat, this.state.lng];
|
||||
const position: L.LatLngExpression = [this.state.lat, this.state.lng];
|
||||
return (
|
||||
<Map center={position} zoom={this.state.zoom}>
|
||||
<TileLayer
|
||||
@@ -513,14 +513,14 @@ export class TooltipExample extends Component<undefined, TooltipExampleState> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const center: Leaflet.LatLngExpression = [51.505, -0.09];
|
||||
const center: L.LatLngExpression = [51.505, -0.09];
|
||||
|
||||
const multiPolygon: Leaflet.LatLngExpression[][] = [
|
||||
const multiPolygon: L.LatLngExpression[][] = [
|
||||
[[51.51, -0.12], [51.51, -0.13], [51.53, -0.13]],
|
||||
[[51.51, -0.05], [51.51, -0.07], [51.53, -0.07]],
|
||||
];
|
||||
|
||||
const rectangle: Leaflet.LatLngBoundsExpression = [
|
||||
const rectangle: L.LatLngBoundsExpression = [
|
||||
[51.49, -0.08],
|
||||
[51.5, -0.06],
|
||||
];
|
||||
@@ -576,31 +576,31 @@ export class TooltipExample extends Component<undefined, TooltipExampleState> {
|
||||
// vector-layers.js
|
||||
export class VectorLayersExample extends Component<undefined, undefined> {
|
||||
render() {
|
||||
const center: Leaflet.LatLngExpression = [51.505, -0.09];
|
||||
const center: L.LatLngExpression = [51.505, -0.09];
|
||||
|
||||
const polyline: Leaflet.LatLngExpression[] = [
|
||||
const polyline: L.LatLngExpression[] = [
|
||||
[51.505, -0.09],
|
||||
[51.51, -0.1],
|
||||
[51.51, -0.12],
|
||||
];
|
||||
|
||||
const multiPolyline: Leaflet.LatLngExpression[][] = [
|
||||
const multiPolyline: L.LatLngExpression[][] = [
|
||||
[[51.5, -0.1], [51.5, -0.12], [51.52, -0.12]],
|
||||
[[51.5, -0.05], [51.5, -0.06], [51.52, -0.06]],
|
||||
];
|
||||
|
||||
const polygon: Leaflet.LatLngExpression[] = [
|
||||
const polygon: L.LatLngExpression[] = [
|
||||
[51.515, -0.09],
|
||||
[51.52, -0.1],
|
||||
[51.52, -0.12],
|
||||
];
|
||||
|
||||
const multiPolygon: Leaflet.LatLngExpression[][] = [
|
||||
const multiPolygon: L.LatLngExpression[][] = [
|
||||
[[51.51, -0.12], [51.51, -0.13], [51.53, -0.13]],
|
||||
[[51.51, -0.05], [51.51, -0.07], [51.53, -0.07]],
|
||||
];
|
||||
|
||||
const rectangle: Leaflet.LatLngBoundsExpression = [
|
||||
const rectangle: L.LatLngBoundsExpression = [
|
||||
[51.49, -0.08],
|
||||
[51.5, -0.06],
|
||||
];
|
||||
@@ -701,7 +701,7 @@ class CenterControl extends MapControl { // note we're extending MapControl fro
|
||||
}
|
||||
}
|
||||
|
||||
const mapControlCenter: Leaflet.LatLngExpression = [51.505, -0.09];
|
||||
const mapControlCenter: L.LatLngExpression = [51.505, -0.09];
|
||||
|
||||
const CenterControlExample = () => (
|
||||
<Map center={mapControlCenter} zoom={13}>
|
||||
|
||||
Reference in New Issue
Block a user