diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts new file mode 100644 index 0000000000..3f4d94e9ce --- /dev/null +++ b/types/leaflet.locatecontrol/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for Leaflet.locate 0.60 +// Project: https://github.com/domoritz/leaflet-locatecontrol +// Definitions by: Denis Carriere +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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; + } +} diff --git a/types/leaflet.locatecontrol/leaflet.locatecontrol-tests.ts b/types/leaflet.locatecontrol/leaflet.locatecontrol-tests.ts new file mode 100644 index 0000000000..40fc41142f --- /dev/null +++ b/types/leaflet.locatecontrol/leaflet.locatecontrol-tests.ts @@ -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 +}})); \ No newline at end of file diff --git a/types/leaflet.locatecontrol/package.json b/types/leaflet.locatecontrol/package.json new file mode 100644 index 0000000000..8afe476d51 --- /dev/null +++ b/types/leaflet.locatecontrol/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/leaflet": "^1.0.58" + } +} diff --git a/types/leaflet.locatecontrol/tsconfig.json b/types/leaflet.locatecontrol/tsconfig.json new file mode 100644 index 0000000000..0637d48285 --- /dev/null +++ b/types/leaflet.locatecontrol/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/leaflet.locatecontrol/tslint.json b/types/leaflet.locatecontrol/tslint.json new file mode 100644 index 0000000000..fdc7cdc370 --- /dev/null +++ b/types/leaflet.locatecontrol/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file