Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added typescript definition file. #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
31 changes: 31 additions & 0 deletions l.ellipse.d.ts
Original file line number Diff line number Diff line change
@@ -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
}

}
}