Skip to content

Commit

Permalink
Removed LineUtil leaflet dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor-Vladyka committed Apr 14, 2020
1 parent 6f76d02 commit 9bb0eab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ getMarker() // returns marker (if markerOptions is passed on creation) to attach
| L.Motion.Event.Resumed | { layer } | Fires on motion resumed on root element only |
| L.Motion.Event.Ended | { layer } | Fires on motion ended on root element only |
| L.Motion.Event.Section | { layer } | Fires on each motion section change in L.Motion.Seq starting with first one |

#### Dependencies:
Please include next leaflet modules to make it work properly, or just whole Leaflet.js :)
``` js
L.Polygon
L.Polyline
L.FeatureGroup
L.Util
```
6 changes: 3 additions & 3 deletions dist/leaflet.motion.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/leaflet.motion.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leaflet.motion",
"version": "0.1.6",
"version": "0.1.7",
"keywords": [
"leaflet.js",
"browser",
Expand Down
2 changes: 1 addition & 1 deletion src/leaflet.motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ L.Motion.Animate = {

this._bounds = L.latLngBounds();
this._linePoints = this._convertLatLngs(latlngs);
if (!L.LineUtil.isFlat(this._linePoints)) {
if (!L.Motion.Utils.isFlat(this._linePoints)) {
this._linePoints = this._linePoints[0];
}

Expand Down
5 changes: 5 additions & 0 deletions src/leaflet.motion.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,10 @@ L.Motion.Utils = {
}

return angle;
},

// Leaflet -> geometries -> LineUtil
isFlat: function (latlngs) {
return !L.Util.isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined');
}
};

0 comments on commit 9bb0eab

Please sign in to comment.