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

View File

@@ -675,10 +675,11 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
this.featureDx = 0;
if (worldBounds) {
bounds = feature.geometry.getBounds();
if (!(bounds.intersectsBounds(this.extent))) {
var wrappedBounds = bounds.wrapDateLine(worldBounds);
this.featureDx = bounds.left - wrappedBounds.left;
}
var worldWidth = worldBounds.getWidth();
var rendererCenterX = (this.extent.left + this.extent.right) / 2;
var featureCenterX = (bounds.left + bounds.right) / 2;
var worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);
this.featureDx = worldsAway * worldWidth;
}
style = this.features[id][1];