Merge pull request #3933 from ahocevar/snap-center-to-pixel
Snap center to pixel to avoid floating point issues
This commit is contained in:
+5
-1
@@ -400,7 +400,11 @@ ol.View.prototype.getState = function() {
|
|||||||
var resolution = /** @type {number} */ (this.getResolution());
|
var resolution = /** @type {number} */ (this.getResolution());
|
||||||
var rotation = this.getRotation();
|
var rotation = this.getRotation();
|
||||||
return /** @type {olx.ViewState} */ ({
|
return /** @type {olx.ViewState} */ ({
|
||||||
center: center.slice(),
|
// Snap center to closest pixel
|
||||||
|
center: [
|
||||||
|
Math.round(center[0] / resolution) * resolution,
|
||||||
|
Math.round(center[1] / resolution) * resolution
|
||||||
|
],
|
||||||
projection: goog.isDef(projection) ? projection : null,
|
projection: goog.isDef(projection) ? projection : null,
|
||||||
resolution: resolution,
|
resolution: resolution,
|
||||||
rotation: rotation
|
rotation: rotation
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user