Proper bounds
This commit is contained in:
@@ -99,18 +99,20 @@ ol.geom.LineString.prototype.getCount = function() {
|
|||||||
*/
|
*/
|
||||||
ol.geom.LineString.prototype.getBounds = function() {
|
ol.geom.LineString.prototype.getBounds = function() {
|
||||||
if (goog.isNull(this.bounds_)) {
|
if (goog.isNull(this.bounds_)) {
|
||||||
var minX, minY = minX = Number.POSITIVE_INFINITY,
|
var dimension = this.dimension,
|
||||||
maxX, maxY = maxX = Number.NEGATIVE_INFINITY,
|
|
||||||
dimension = this.dimension,
|
|
||||||
vertices = this.vertices,
|
vertices = this.vertices,
|
||||||
id = this.sharedId_,
|
id = this.sharedId_,
|
||||||
count = vertices.getCount(id),
|
count = vertices.getCount(id),
|
||||||
start = vertices.getStart(id),
|
start = vertices.getStart(id),
|
||||||
end = start + (count * dimension),
|
end = start + (count * dimension),
|
||||||
coordinates = vertices.coordinates,
|
coordinates = vertices.coordinates,
|
||||||
|
minX, maxX,
|
||||||
|
minY, maxY,
|
||||||
x, y, i;
|
x, y, i;
|
||||||
|
|
||||||
for (i = start; i < end; i += dimension) {
|
minX = maxX = coordinates[start];
|
||||||
|
minY = maxY = coordinates[start + 1];
|
||||||
|
for (i = start + dimension; i < end; i += dimension) {
|
||||||
x = coordinates[i];
|
x = coordinates[i];
|
||||||
y = coordinates[i + 1];
|
y = coordinates[i + 1];
|
||||||
if (x < minX) {
|
if (x < minX) {
|
||||||
|
|||||||
Reference in New Issue
Block a user