Only do extent build if necessary

This commit is contained in:
Tom MacWright
2013-02-08 11:36:25 -05:00
parent 717221a4e8
commit afcb1837e7

View File

@@ -15,7 +15,7 @@ iD.geo.Extent.prototype = [[], []];
_.extend(iD.geo.Extent.prototype, {
extend: function (obj) {
obj = new iD.geo.Extent(obj);
if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
return iD.geo.Extent([Math.min(obj[0][0], this[0][0]),
Math.min(obj[0][1], this[0][1])],
[Math.max(obj[1][0], this[1][0]),
@@ -28,7 +28,7 @@ _.extend(iD.geo.Extent.prototype, {
},
intersects: function (obj) {
obj = new iD.geo.Extent(obj);
if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
return obj[0][0] <= this[1][0] &&
obj[0][1] <= this[1][1] &&
obj[1][0] >= this[0][0] &&