Check bounds before clipping
This commit is contained in:
parent
cc04a82be1
commit
4952b37256
@ -65,11 +65,6 @@ L.Polygon = L.Polyline.extend({
|
||||
},
|
||||
|
||||
_clipPoints: function () {
|
||||
if (this.options.noClip) {
|
||||
this._parts = this._rings;
|
||||
return;
|
||||
}
|
||||
|
||||
// polygons need a different clipping algorithm so we redefine that
|
||||
|
||||
var bounds = this._renderer._bounds,
|
||||
@ -80,6 +75,14 @@ L.Polygon = L.Polyline.extend({
|
||||
bounds = new L.Bounds(bounds.min.subtract(p), bounds.max.add(p));
|
||||
|
||||
this._parts = [];
|
||||
if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.noClip) {
|
||||
this._parts = this._rings;
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
|
||||
clipped = L.PolyUtil.clipPolygon(this._rings[i], bounds, true);
|
||||
|
@ -165,15 +165,19 @@ L.Polyline = L.Path.extend({
|
||||
|
||||
// clip polyline by renderer bounds so that we have less to render for performance
|
||||
_clipPoints: function () {
|
||||
var bounds = this._renderer._bounds;
|
||||
|
||||
this._parts = [];
|
||||
if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.noClip) {
|
||||
this._parts = this._rings;
|
||||
return;
|
||||
}
|
||||
|
||||
this._parts = [];
|
||||
|
||||
var parts = this._parts,
|
||||
bounds = this._renderer._bounds,
|
||||
i, j, k, len, len2, segment, points;
|
||||
|
||||
for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user