@types/leaflet-draw
Advanced tools
Comparing version 0.4.12 to 0.4.13
@@ -6,2 +6,3 @@ // Type definitions for leaflet-draw 0.4 | ||
// Yun Shi <https://github.com/YunS-Stacy> | ||
// Kevin Richter <https://github.com/beschoenen> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -17,2 +18,59 @@ // TypeScript Version: 2.3 | ||
interface ToolbarAction { | ||
title: string; | ||
text: string; | ||
callback: () => void; | ||
context: object; | ||
} | ||
interface ToolbarModeHandler { | ||
enabled: boolean; | ||
handler: Handler; | ||
title: string; | ||
} | ||
interface ToolbarOptions { | ||
polyline?: DrawOptions.PolylineOptions; | ||
polygon?: DrawOptions.PolygonOptions; | ||
rectangle?: DrawOptions.RectangleOptions; | ||
circle?: DrawOptions.CircleOptions; | ||
marker?: DrawOptions.MarkerOptions; | ||
circlemarker?: DrawOptions.CircleOptions; | ||
} | ||
interface PrecisionOptions { | ||
km?: number; | ||
ha?: number; | ||
m?: number; | ||
mi?: number; | ||
ac?: number; | ||
yd?: number; | ||
ft?: number; | ||
nm?: number; | ||
} | ||
class Toolbar extends Class { | ||
constructor(options?: ToolbarOptions); | ||
addToolbar(map: Map): HTMLElement | void; | ||
removeToolbar(): void; | ||
} | ||
class DrawToolbar extends Toolbar { | ||
getModeHandlers(map: Map): ToolbarModeHandler[]; | ||
getActions(handler: Draw.Feature): ToolbarAction[]; | ||
setOptions(options: Control.DrawConstructorOptions): void; | ||
} | ||
class EditToolbar extends Toolbar { | ||
getModeHandlers(map: Map): ToolbarModeHandler[]; | ||
getActions(handler: Draw.Feature): ToolbarAction[]; | ||
setOptions(options: Control.DrawConstructorOptions): void; | ||
} | ||
namespace Control { | ||
@@ -35,5 +93,5 @@ interface DrawConstructorOptions { | ||
/** | ||
* The options used to configure the edit toolbar. | ||
* The options used to configure the edit toolbar. | ||
* | ||
* Default value: false | ||
* Default value: false | ||
*/ | ||
@@ -47,3 +105,3 @@ edit?: EditOptions; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -55,3 +113,3 @@ polyline?: DrawOptions.PolylineOptions | false; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -63,3 +121,3 @@ polygon?: DrawOptions.PolygonOptions | false; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -71,3 +129,3 @@ rectangle?: DrawOptions.RectangleOptions | false; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -79,3 +137,3 @@ circle?: DrawOptions.CircleOptions | false; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -87,3 +145,3 @@ circlemarker?: DrawOptions.CircleMarkerOptions | false; | ||
* | ||
* Default value: {} | ||
* Default value: {} | ||
*/ | ||
@@ -127,2 +185,11 @@ marker?: DrawOptions.MarkerOptions | false; | ||
namespace DrawOptions { | ||
interface SimpleShapeOptions { | ||
/** | ||
* Determines if the draw tool remains enabled after drawing a shape. | ||
* | ||
* Default value: false | ||
*/ | ||
repeatMode?: boolean; | ||
} | ||
interface PolylineOptions { | ||
@@ -137,2 +204,9 @@ /** | ||
/** | ||
* Determines if the draw tool remains enabled after drawing a shape. | ||
* | ||
* Default value: false | ||
*/ | ||
repeatMode?: boolean; | ||
/** | ||
* Configuration options for the error that displays if an intersection is detected. | ||
@@ -142,4 +216,8 @@ * | ||
*/ | ||
drawError?: any; | ||
drawError?: DrawErrorOptions; | ||
icon?: Icon | DivIcon; | ||
touchIcon?: Icon | DivIcon; | ||
/** | ||
@@ -153,2 +231,9 @@ * Distance in pixels between each guide dash. | ||
/** | ||
* The maximum length of the guide line | ||
* | ||
* Default value: 4000 | ||
*/ | ||
maxGuideLineLength?: number; | ||
/** | ||
* The options used when drawing the polyline/polygon on the map. | ||
@@ -158,3 +243,3 @@ * | ||
*/ | ||
shapeOptions?: L.PolylineOptions; | ||
shapeOptions?: PathOptions; | ||
@@ -169,4 +254,25 @@ /** | ||
/** | ||
* This should be a high number to ensure that you can draw over all other layers on the map. | ||
* When not metric, to use feet instead of yards for display. | ||
* | ||
* Default value: true | ||
*/ | ||
feet?: boolean; | ||
/** | ||
* When not metric, not feet use nautic mile for display | ||
* | ||
* Default value: false | ||
*/ | ||
nautic?: boolean; | ||
/** | ||
* Whether to display distance in the tooltip | ||
* | ||
* Default value: true | ||
*/ | ||
showLength?: boolean; | ||
/** | ||
* This should be a high number to ensure that you can draw over all other layers on the map. | ||
* | ||
* Default value: 2000 | ||
@@ -177,7 +283,14 @@ */ | ||
/** | ||
* Determines if the draw tool remains enabled after drawing a shape. | ||
* To change distance calculation | ||
* | ||
* Default value: false | ||
* Default value: 1 | ||
*/ | ||
repeatMode?: boolean; | ||
factor?: number; | ||
/** | ||
* Once this number of points are placed, finish shape | ||
* | ||
* Default value: 0 | ||
*/ | ||
maxPoints?: number; | ||
} | ||
@@ -193,5 +306,12 @@ | ||
showArea?: boolean; | ||
/** | ||
* Defines the precision for each type of unit (e.g. {km: 2, ft: 0} | ||
* | ||
* Default value: {} | ||
*/ | ||
precision?: PrecisionOptions; | ||
} | ||
interface RectangleOptions { | ||
interface RectangleOptions extends SimpleShapeOptions { | ||
/** | ||
@@ -205,10 +325,10 @@ * The options used when drawing the rectangle on the map. | ||
/** | ||
* Determines if the draw tool remains enabled after drawing a shape. | ||
* Whether to use the metric measurement system or imperial | ||
* | ||
* Default value: false | ||
* Default value: true | ||
*/ | ||
repeatMode?: boolean; | ||
metric?: boolean; | ||
} | ||
interface CircleOptions { | ||
interface CircleOptions extends SimpleShapeOptions { | ||
/** | ||
@@ -222,7 +342,28 @@ * The options used when drawing the circle on the map. | ||
/** | ||
* Determines if the draw tool remains enabled after drawing a shape. | ||
* Whether to show the radius in the tooltip | ||
* | ||
* Default value: true | ||
*/ | ||
showRadius?: boolean; | ||
/** | ||
* Whether to use the metric measurement system or imperial | ||
* | ||
* Default value: true | ||
*/ | ||
metric?: boolean; | ||
/** | ||
* When not metric, use feet instead of yards for display | ||
* | ||
* Default value: true | ||
*/ | ||
feet?: boolean; | ||
/** | ||
* When not metric, not feet use nautic mile for display | ||
* | ||
* Default value: false | ||
*/ | ||
repeatMode?: boolean; | ||
nautic?: boolean; | ||
} | ||
@@ -330,2 +471,7 @@ | ||
} | ||
interface DrawErrorOptions { | ||
color?: string; | ||
timeout?: number; | ||
} | ||
} | ||
@@ -348,2 +494,5 @@ | ||
const DELETESTOP: string; | ||
const TOOLBAROPENED: string; | ||
const TOOLBARCLOSED: string; | ||
const TOOLBARCONTEXT: string; | ||
} | ||
@@ -362,3 +511,5 @@ | ||
class SimpleShape extends Feature { } | ||
class SimpleShape extends Feature { | ||
} | ||
class Marker extends Feature { | ||
@@ -371,3 +522,3 @@ constructor( | ||
class CircleMarker extends Feature { | ||
class CircleMarker extends Marker { | ||
constructor( | ||
@@ -379,3 +530,3 @@ map: Map, | ||
class Circle extends Feature { | ||
class Circle extends SimpleShape { | ||
constructor( | ||
@@ -392,5 +543,11 @@ map: Map, | ||
) | ||
deleteLastVertex(): void; | ||
addVertex(latlng: LatLng): void; | ||
completeShape(): void; | ||
} | ||
class Rectangle extends Feature { | ||
class Rectangle extends SimpleShape { | ||
constructor( | ||
@@ -402,3 +559,3 @@ map: Map, | ||
class Polygon extends Feature { | ||
class Polygon extends Polyline { | ||
constructor( | ||
@@ -409,2 +566,16 @@ map: Map, | ||
} | ||
class Tooltip extends Class { | ||
constructor(map: Map); | ||
dispose(): void; | ||
updateContent(labelText?: { text: string, subtext?: string }): Tooltip; | ||
updatePosition(latlng: LatLng): Tooltip; | ||
showAsError(): Tooltip; | ||
removeError(): Tooltip; | ||
} | ||
} | ||
@@ -456,2 +627,9 @@ | ||
interface DrawVertex extends Event { | ||
/** | ||
* List of all layers just being added from the map. | ||
*/ | ||
layers: LayerGroup; | ||
} | ||
interface EditStart extends Event { | ||
@@ -464,2 +642,25 @@ /** | ||
interface EditMove extends Event { | ||
/** | ||
* Layer that was just moved. | ||
*/ | ||
layer: Layer; | ||
} | ||
interface EditResize extends Event { | ||
/** | ||
* Layer that was just resized. | ||
*/ | ||
layer: Layer; | ||
} | ||
interface EditVertex extends Event { | ||
/** | ||
* List of all layers just being edited from the map. | ||
*/ | ||
layers: LayerGroup; | ||
poly: Polyline | Polygon; | ||
} | ||
interface EditStop extends Event { | ||
@@ -485,2 +686,11 @@ /** | ||
} | ||
interface ToolbarOpened extends Event { | ||
} | ||
interface ToolbarClosed extends Event { | ||
} | ||
interface MarkerContext extends Event { | ||
} | ||
} | ||
@@ -495,6 +705,102 @@ | ||
/** | ||
* Returns n in specified number format (if defined) and precision | ||
*/ | ||
function formattedNumber(n: string, precision: number): string; | ||
/** | ||
* Returns a readable area string in yards or metric | ||
*/ | ||
function readableArea(area: number, isMetric: boolean): string; | ||
function readableArea(area: number, isMetric?: boolean, precision?: PrecisionOptions): string; | ||
/** | ||
* Converts metric distance to distance string. | ||
* The value will be rounded as defined by the precision option object. | ||
*/ | ||
function readableDistance(distance: number, isMetric?: boolean, isFeet?: boolean, isNauticalMile?: boolean, precision?: PrecisionOptions): string; | ||
/** | ||
* Returns true if the Leaflet version is 0.7.x, false otherwise. | ||
*/ | ||
function isVersion07x(): boolean; | ||
} | ||
namespace LatLngUtil { | ||
/** | ||
* Clone the latLng point or points or nested points and return an array with those points | ||
*/ | ||
function cloneLatLngs(latlngs: LatLng[]): LatLng[][]; | ||
/** | ||
* Clone the latLng and return a new LatLng object. | ||
*/ | ||
function cloneLatLng(latlng: LatLng): LatLng; | ||
} | ||
namespace EditToolbar { | ||
class Edit extends Toolbar { | ||
constructor(map: Map, options?: ToolbarOptions); | ||
revertLayers(): void; | ||
save(): void; | ||
} | ||
class Delete extends Toolbar { | ||
constructor(map: Map, options?: ToolbarOptions); | ||
revertLayers(): void; | ||
save(): void; | ||
removeAllLayers(): void; | ||
} | ||
} | ||
namespace EditOptions { | ||
interface EditPolyVerticesEditOptions { | ||
icon?: Icon | DivIcon; | ||
touchIcon?: Icon | DivIcon; | ||
drawError?: DrawOptions.DrawErrorOptions; | ||
} | ||
interface EditSimpleShapeOptions { | ||
moveIcon?: Icon | DivIcon; | ||
resizeIcon?: Icon | DivIcon; | ||
touchMoveIcon?: Icon | DivIcon; | ||
touchResizeIcon?: Icon | DivIcon; | ||
} | ||
} | ||
namespace Edit { | ||
class Circle extends CircleMarker { | ||
} | ||
class CircleMarker extends SimpleShape { | ||
} | ||
class Marker extends Handler { | ||
constructor(marker: Marker, options?: object); | ||
} | ||
class Poly extends Handler { | ||
constructor(poly: Draw.Polyline); | ||
updateMarkers(): void; | ||
} | ||
class PolyVerticesEdit extends Handler { | ||
constructor(poly: Poly, latlngs: LatLngExpression[], options?: EditOptions.EditPolyVerticesEditOptions); | ||
updateMarkers(): void; | ||
} | ||
class Rectangle extends SimpleShape { | ||
} | ||
class SimpleShape extends Handler { | ||
constructor(shape: SimpleShape, options?: EditOptions.EditSimpleShapeOptions); | ||
updateMarkers(): void; | ||
} | ||
} | ||
} |
{ | ||
"name": "@types/leaflet-draw", | ||
"version": "0.4.12", | ||
"version": "0.4.13", | ||
"description": "TypeScript definitions for leaflet-draw", | ||
@@ -21,2 +21,7 @@ "license": "MIT", | ||
"githubUsername": "YunS-Stacy" | ||
}, | ||
{ | ||
"name": "Kevin Richter", | ||
"url": "https://github.com/beschoenen", | ||
"githubUsername": "beschoenen" | ||
} | ||
@@ -27,3 +32,3 @@ ], | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git.git" | ||
}, | ||
@@ -34,4 +39,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "3ff5ea5f2b03896caa8d3836cecd3a7ca8b541bf60fca2ebca4aa2969e6f5eee", | ||
"typesPublisherContentHash": "9234f308795cb02294ffc73f588b059548d4155abb7f244ac80cad191a0542d8", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -8,6 +8,6 @@ # Installation | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet-draw | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped.git/tree/master/types/leaflet-draw | ||
Additional Details | ||
* Last updated: Tue, 03 Apr 2018 18:36:17 GMT | ||
* Last updated: Tue, 08 May 2018 16:41:34 GMT | ||
* Dependencies: leaflet | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Matt Guest <https://github.com/matt-guest>, Ryan Blace <https://github.com/reblace>, Yun Shi <https://github.com/YunS-Stacy>. | ||
These definitions were written by Matt Guest <https://github.com/matt-guest>, Ryan Blace <https://github.com/reblace>, Yun Shi <https://github.com/YunS-Stacy>, Kevin Richter <https://github.com/beschoenen>. |
Sorry, the diff of this file is not supported yet
19228
643