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

Add the ability to draw curves #1008

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
23 changes: 15 additions & 8 deletions build/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,44 @@ var deps = {
Core: {
src: [
'Leaflet.draw.js',
'Leaflet.Draw.Event.js'
'Leaflet.Draw.Event.js',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaningless change for this PR

],
desc: 'The core of the plugin. Currently only includes the version.'
},

Common: {
src: ['ext/CurveCommon.js'],
desc: 'The files shared with multiple objects of the plugin.'
},

DrawHandlers: {
src: [
'draw/handler/Draw.Feature.js',
'draw/handler/Draw.Polyline.js',
'draw/handler/Draw.Curve.js',
'draw/handler/Draw.Polygon.js',
'draw/handler/Draw.SimpleShape.js',
'draw/handler/Draw.Rectangle.js',
'draw/handler/Draw.Marker.js',
'draw/handler/Draw.CircleMarker.js',
'draw/handler/Draw.Circle.js'
'draw/handler/Draw.Marker.js',
'draw/handler/Draw.CircleMarker.js',
'draw/handler/Draw.Circle.js'
Comment on lines -17 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace-only changes should be avoided

],
desc: 'Drawing handlers for: polylines, polygons, rectangles, circles, circlemarkers and markers.',
deps: ['Core']
deps: ['Core', 'Common']
},

EditHandlers: {
src: [
'edit/handler/Edit.Marker.js',
'edit/handler/Edit.Poly.js',
'edit/handler/Edit.Curve.js',
'edit/handler/Edit.SimpleShape.js',
'edit/handler/Edit.Rectangle.js',
'edit/handler/Edit.CircleMarker.js',
'edit/handler/Edit.CircleMarker.js',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

'edit/handler/Edit.Circle.js'
],
desc: 'Editing handlers for: polylines, polygons, rectangles, circlemarkers and circles.',
deps: ['Core']
desc: 'Editing handlers for: polylines, curves, polygons, rectangles, circlemarkers and circles.',
deps: ['Core', 'Common']
},

Extensions: {
Expand Down
2 changes: 2 additions & 0 deletions build/docs-index.leafdoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ This file just defines the order of the classes in the docs.
@class L.Draw.Polyline
@class L.Draw.Rectangle
@class L.Draw.Polygon
@class L.Draw.Curve

@class L.Edit.SimpleShape
@class L.Edit.Marker
@class L.Edit.CircleMarker
@class L.Edit.Circle
@class L.Edit.Polyline
@class L.Edit.Curve
@class L.Edit.Rectangle
@class L.EditToolbar.Edit
@class L.EditToolbar.Delete
Expand Down
9 changes: 9 additions & 0 deletions build/docs-misc.leafdoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ for this section of the documentation, please edit docs-misc.leafdoc in the buil
| --------- | ----- | --------- | ------------- |
| polyline | [PolylineOptions](#polylineoptions) | `{ }` | Polyline draw handler options. Set to `false` to disable handler. |
| polygon | [PolygonOptions](#polygonoptions) | `{ }` | Polygon draw handler options. Set to `false` to disable handler. |
| curve | [CurveOptions](#curveoptions) | `{ }` | Curve draw handler options. Set to `false` to disable handler. |
| rectangle | [RectangleOptions](#rectangleoptions) | `{ }` | Rectangle draw handler options. Set to `false` to disable handler. |
| circle | [CircleOptions](#circleoptions) | `{ }` | Circle draw handler options. Set to `false` to disable handler. |
| marker | [MarkerOptions](#markeroptions) | `{ }` | Marker draw handler options. Set to `false` to disable handler. |
Expand Down Expand Up @@ -75,6 +76,14 @@ for this section of the documentation, please edit docs-misc.leafdoc in the buil
| precision | Object | `{km: 2, ha: 2, m: 0, mi: 2, ac: 2, yd: 0, ft: 0, nm: 2}` | Defines the precision to use for numbers of each type of unit. Possible units are `km` (kilometers), `ha` (hectares), `m` (metres), `mi` (miles), `ac` (acres), `ya` (yards), `ft` (feet), `nm` (nautical miles). For example `{km: 1}` changes the default precision for km and km² to one which gives values like `1.5 km` and `15.0 km²` in stead of `1.53 km` and `15.01 km²`.


@namespace CurveOptions

| Option | Type | Default | Description
| --- | --- | --- | ---
| shapeOptions | [Leaflet Path options](http://leafletjs.com/reference.html#path-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Curve.js#L19) | The options used when drawing the curve on the map.
| shapeGuideOptions | [Leaflet Path options](http://leafletjs.com/reference.html#path-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Curve.js#L27) | The options used when drawing preview curve on mouse hover/drag.
| repeatMode | Bool | `false` | Determines if the draw tool remains enabled after drawing a shape.

@namespace RectangleOptions

| Option | Type | Default | Description
Expand Down
Binary file added dist/images/bezier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/examples-0.7.x/full.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>Leaflet.draw vector editing handlers</title>

<script src="libs/leaflet-src.js"></script>
<script src="libs/Curve.js"></script>
<link rel="stylesheet" href="libs/leaflet.css"/>

<script src="../../src/Leaflet.draw.js"></script>
Expand All @@ -19,6 +20,7 @@
<script src="../../src/ext/Polygon.Intersect.js"></script>
<script src="../../src/ext/Polyline.Intersect.js"></script>
<script src="../../src/ext/TouchEvents.js"></script>
<script src="../../src/ext/CurveCommon.js"></script>

<script src="../../src/draw/DrawToolbar.js"></script>
<script src="../../src/draw/handler/Draw.Feature.js"></script>
Expand All @@ -29,6 +31,7 @@
<script src="../../src/draw/handler/Draw.CircleMarker.js"></script>
<script src="../../src/draw/handler/Draw.Polygon.js"></script>
<script src="../../src/draw/handler/Draw.Rectangle.js"></script>
<script src="../../src/draw/handler/Draw.Curve.js"></script>


<script src="../../src/edit/EditToolbar.js"></script>
Expand All @@ -43,6 +46,8 @@
<script src="../../src/edit/handler/Edit.Marker.js"></script>
<script src="../../src/edit/handler/Edit.CircleMarker.js"></script>
<script src="../../src/edit/handler/Edit.Circle.js"></script>
<script src="../../src/edit/handler/Edit.Curve.js"></script>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace?

</head>
<body>
<div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
Expand Down
Loading