Calculate x-offset for features outside the world bounds.
This commit is contained in:
@@ -580,7 +580,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
|||||||
getLocalXY: function(point) {
|
getLocalXY: function(point) {
|
||||||
var resolution = this.getResolution();
|
var resolution = this.getResolution();
|
||||||
var extent = this.extent;
|
var extent = this.extent;
|
||||||
var x = (point.x / resolution + (-extent.left / resolution));
|
var x = ((point.x - this.featureDx) / resolution + (-extent.left / resolution));
|
||||||
var y = ((extent.top / resolution) - point.y / resolution);
|
var y = ((extent.top / resolution) - point.y / resolution);
|
||||||
return [x, y];
|
return [x, y];
|
||||||
},
|
},
|
||||||
@@ -666,10 +666,21 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
|||||||
this.hitContext.clearRect(0, 0, width, height);
|
this.hitContext.clearRect(0, 0, width, height);
|
||||||
}
|
}
|
||||||
var labelMap = [];
|
var labelMap = [];
|
||||||
var feature, style;
|
var feature, style, bounds;
|
||||||
|
var worldBounds = (this.map.baseLayer && this.map.baseLayer.wrapDateLine) && this.map.getMaxExtent();
|
||||||
for (var id in this.features) {
|
for (var id in this.features) {
|
||||||
if (!this.features.hasOwnProperty(id)) { continue; }
|
if (!this.features.hasOwnProperty(id)) { continue; }
|
||||||
feature = this.features[id][0];
|
feature = this.features[id][0];
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
style = this.features[id][1];
|
style = this.features[id][1];
|
||||||
this.drawGeometry(feature.geometry, style, feature.id);
|
this.drawGeometry(feature.geometry, style, feature.id);
|
||||||
if(style.label) {
|
if(style.label) {
|
||||||
|
|||||||
Reference in New Issue
Block a user