Revert "Merge pull request #7098 from ahocevar/no-math-round"

This reverts commit 5b75666755, reversing
changes made to ff9ef481db.
This commit is contained in:
Andreas Hocevar
2017-09-15 08:39:05 +02:00
parent 53937642c8
commit 010dd87d49
+4 -4
View File
@@ -475,7 +475,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered_.left_ !== '') { if (this.rendered_.left_ !== '') {
this.rendered_.left_ = style.left = ''; this.rendered_.left_ = style.left = '';
} }
var right = (mapSize[0] - pixel[0] - offsetX) + 'px'; var right = Math.round(mapSize[0] - pixel[0] - offsetX) + 'px';
if (this.rendered_.right_ != right) { if (this.rendered_.right_ != right) {
this.rendered_.right_ = style.right = right; this.rendered_.right_ = style.right = right;
} }
@@ -488,7 +488,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
positioning == ol.OverlayPositioning.TOP_CENTER) { positioning == ol.OverlayPositioning.TOP_CENTER) {
offsetX -= this.element_.offsetWidth / 2; offsetX -= this.element_.offsetWidth / 2;
} }
var left = (pixel[0] + offsetX) + 'px'; var left = Math.round(pixel[0] + offsetX) + 'px';
if (this.rendered_.left_ != left) { if (this.rendered_.left_ != left) {
this.rendered_.left_ = style.left = left; this.rendered_.left_ = style.left = left;
} }
@@ -499,7 +499,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered_.top_ !== '') { if (this.rendered_.top_ !== '') {
this.rendered_.top_ = style.top = ''; this.rendered_.top_ = style.top = '';
} }
var bottom = (mapSize[1] - pixel[1] - offsetY) + 'px'; var bottom = Math.round(mapSize[1] - pixel[1] - offsetY) + 'px';
if (this.rendered_.bottom_ != bottom) { if (this.rendered_.bottom_ != bottom) {
this.rendered_.bottom_ = style.bottom = bottom; this.rendered_.bottom_ = style.bottom = bottom;
} }
@@ -512,7 +512,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
positioning == ol.OverlayPositioning.CENTER_RIGHT) { positioning == ol.OverlayPositioning.CENTER_RIGHT) {
offsetY -= this.element_.offsetHeight / 2; offsetY -= this.element_.offsetHeight / 2;
} }
var top = (pixel[1] + offsetY) + 'px'; var top = Math.round(pixel[1] + offsetY) + 'px';
if (this.rendered_.top_ != top) { if (this.rendered_.top_ != top) {
this.rendered_.top_ = style.top = top; this.rendered_.top_ = style.top = top;
} }