Check view extent within image extent
This commit is contained in:
@@ -201,14 +201,6 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
extent = extent.slice();
|
||||
var centerX = (extent[0] + extent[2]) / 2;
|
||||
var centerY = (extent[1] + extent[3]) / 2;
|
||||
if (this.ratio_ != 1) {
|
||||
var halfWidth = this.ratio_ * ol.extent.getWidth(extent) / 2;
|
||||
var halfHeight = this.ratio_ * ol.extent.getHeight(extent) / 2;
|
||||
extent[0] = centerX - halfWidth;
|
||||
extent[1] = centerY - halfHeight;
|
||||
extent[2] = centerX + halfWidth;
|
||||
extent[3] = centerY + halfHeight;
|
||||
}
|
||||
|
||||
var imageResolution = resolution / pixelRatio;
|
||||
|
||||
@@ -231,6 +223,15 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
return image;
|
||||
}
|
||||
|
||||
if (this.ratio_ != 1) {
|
||||
var halfWidth = this.ratio_ * ol.extent.getWidth(extent) / 2;
|
||||
var halfHeight = this.ratio_ * ol.extent.getHeight(extent) / 2;
|
||||
extent[0] = centerX - halfWidth;
|
||||
extent[1] = centerY - halfHeight;
|
||||
extent[2] = centerX + halfWidth;
|
||||
extent[3] = centerY + halfHeight;
|
||||
}
|
||||
|
||||
var params = {
|
||||
'SERVICE': 'WMS',
|
||||
'VERSION': ol.DEFAULT_WMS_VERSION,
|
||||
|
||||
Reference in New Issue
Block a user