From 97f5ea39d06256e2dabbb10dcc8fa35ad7362c17 Mon Sep 17 00:00:00 2001 From: cshaffer Date: Thu, 27 Sep 2018 08:07:25 -0400 Subject: [PATCH 1/2] Added typescript definition file. --- l.ellipse.d.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 l.ellipse.d.ts diff --git a/l.ellipse.d.ts b/l.ellipse.d.ts new file mode 100644 index 0000000..52fc27b --- /dev/null +++ b/l.ellipse.d.ts @@ -0,0 +1,31 @@ +import * as L from 'leaflet' + +declare module 'leaflet' { + + /** + * Creates an ellipse. + * @param latlng The position of the center of the ellipse. + * @param radii The semi-major and semi-minor axis in meters + * @param tilt The rotation of the ellipse in degrees from west + * @param options Options dictionary to pass to L.Path + */ + function ellipse(latlng: number[], radii: number[], tilt: number, options: EllipseOptions): Path.Ellipse; + + interface EllipseOptions extends L.PathOptions { + fill: boolean; + startAngle: number; + endAngle: number; + } + + namespace Path { + class Ellipse extends L.Path { + constructor(options?: EllipseOptions) + + setRadius(radii: number[]): this + getRadius(): L.Point + setTilt(tilt: number): this + getBounds(): L.LatLngBounds + } + + } +} From e0019ad52fdd7dab58222903597e14cdd98cbdd9 Mon Sep 17 00:00:00 2001 From: cms26 Date: Thu, 3 Jan 2019 16:15:32 -0500 Subject: [PATCH 2/2] Typedef comments to readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 7745060..e9ad804 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,11 @@ After instantiating the map create a new ellipse. var ellipse = L.ellipse([51.5, -0.09], [500, 100], 90).addTo(map); +Access the typed data via + + import 'leaflet-ellipse/l.ellipse'; + + ## API *Factory method*