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

Adding a getBounds method for Path #253

Merged
merged 2 commits into from
Aug 16, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Moving "getBounds" from L.Path to L.Polyline as some descendants of L…
….Path dont' have a "getLatLngs" method.
  • Loading branch information
JasonSanford committed Aug 15, 2011
commit da379754b1d6e808435544fbce28862cf658d780
9 changes: 0 additions & 9 deletions src/layer/vector/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ L.Path = L.Class.extend({
this._updateStyle();
}
return this;
},

getBounds: function() {
var b = new L.LatLngBounds();
var latLngs = this.getLatLngs();
for (var i = 0, len = latLngs.length; i < len; i++) {
b.extend(latLngs[i]);
}
return b;
},

_initElements: function() {
Expand Down
9 changes: 9 additions & 0 deletions src/layer/vector/Polyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ L.Polyline = L.Path.extend({
}
if (minPoint) minPoint.distance = Math.sqrt(minDistance);
return minPoint;
},

getBounds: function() {
var b = new L.LatLngBounds();
var latLngs = this.getLatLngs();
for (var i = 0, len = latLngs.length; i < len; i++) {
b.extend(latLngs[i]);
}
return b;
},

_getPathPartStr: function(points) {
Expand Down