mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #15455 from DenisCarriere/leaflet.locatecontrol
Implement Leaflet.Locate type definition
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for Leaflet.locate 0.60
|
||||
// Project: https://github.com/domoritz/leaflet-locatecontrol
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
|
||||
declare namespace L {
|
||||
namespace Control {
|
||||
export interface Locate extends L.Control {}
|
||||
export interface LocateOptions {
|
||||
position?: string
|
||||
layer?: L.Layer
|
||||
setView?: boolean | string
|
||||
flyTo?: boolean
|
||||
keepCurrentZoomLevel?: boolean
|
||||
clickBehavior?: any
|
||||
returnToPrevBounds?: boolean
|
||||
cacheLocation?: boolean
|
||||
drawCircle?: boolean
|
||||
drawMarker?: boolean
|
||||
markerClass?: any
|
||||
circleStyle?: L.PathOptions
|
||||
markerStyle?: L.PathOptions
|
||||
followCircleStyle?: L.PathOptions
|
||||
followMarkerStyle?: L.PathOptions
|
||||
icon?: string
|
||||
iconLoading?: string
|
||||
iconElementTag?: string
|
||||
circlePadding?: number[]
|
||||
onLocationError?: any
|
||||
onLocationOutsideMapBounds?: any
|
||||
showPopup?: boolean
|
||||
strings?: any
|
||||
locateOptions?: L.LocateOptions
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
/**
|
||||
* Creates a Leaflet.Locate control
|
||||
*/
|
||||
export function locate(options?: Control.LocateOptions): L.Control.Locate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
var map = L.map('map', {
|
||||
center: [51.505, -0.09],
|
||||
zoom: 13
|
||||
});
|
||||
|
||||
// Defaults
|
||||
L.control.locate().addTo(map);
|
||||
|
||||
// Simple
|
||||
var lc = L.control.locate({
|
||||
position: 'topright',
|
||||
strings: {
|
||||
title: "Show me where I am, yo!"
|
||||
}
|
||||
}).addTo(map);
|
||||
|
||||
// Locate Options
|
||||
map.addControl(L.control.locate({
|
||||
locateOptions: {
|
||||
maxZoom: 10,
|
||||
enableHighAccuracy: true
|
||||
}}));
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/leaflet": "^1.0.58"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leaflet.locatecontrol-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Reference in New Issue
Block a user