Determine how many worlds away we are instead of simply wrapping.

This commit is contained in:
tschaub
2011-09-30 13:22:29 -06:00
parent fe08a843ee
commit b82a24ef36
+5 -4
View File
@@ -675,10 +675,11 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
this.featureDx = 0; this.featureDx = 0;
if (worldBounds) { if (worldBounds) {
bounds = feature.geometry.getBounds(); bounds = feature.geometry.getBounds();
if (!(bounds.intersectsBounds(this.extent))) { var worldWidth = worldBounds.getWidth();
var wrappedBounds = bounds.wrapDateLine(worldBounds); var rendererCenterX = (this.extent.left + this.extent.right) / 2;
this.featureDx = bounds.left - wrappedBounds.left; var featureCenterX = (bounds.left + bounds.right) / 2;
} var worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);
this.featureDx = worldsAway * worldWidth;
} }
style = this.features[id][1]; style = this.features[id][1];