world shifting for renderers

This commit is contained in:
ahocevar
2011-10-02 15:40:44 -06:00
parent 868757501f
commit de8425db17

View File

@@ -188,9 +188,20 @@ OpenLayers.Renderer = OpenLayers.Class({
}
if (!bounds.intersectsBounds(this.extent, {worldBounds: worldBounds})) {
style = {display: "none"};
} else {
this.featureDx = 0;
if (worldBounds) {
bounds = feature.geometry.getBounds();
var worldWidth = worldBounds.getWidth(),
rendererCenterX = (this.extent.left + this.extent.right) / 2,
featureCenterX = (bounds.left + bounds.right) / 2,
worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);
this.featureDx = worldsAway * worldWidth;
}
}
var rendered = this.drawGeometry(feature.geometry, style, feature.id);
if(style.display != "none" && style.label && rendered !== false) {
var location = feature.geometry.getCentroid();
if(style.labelXOffset || style.labelYOffset) {
var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;