From de3b315ad75c67cc0c75b93246887db456280f40 Mon Sep 17 00:00:00 2001 From: Austin Hyde Date: Tue, 28 Jan 2014 09:10:24 -0500 Subject: [PATCH] Round CSS offsets to nearest integer --- src/ol/dom/dom.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol/dom/dom.js b/src/ol/dom/dom.js index 060a8653b8..04d98bc097 100644 --- a/src/ol/dom/dom.js +++ b/src/ol/dom/dom.js @@ -253,11 +253,11 @@ ol.dom.transformElement2D = dx /= m11; dy /= m22; - opt_translationElement.style.left = dx + 'px'; - opt_translationElement.style.top = dy + 'px'; + opt_translationElement.style.left = Math.round(dx) + 'px'; + opt_translationElement.style.top = Math.round(dy) + 'px'; } else { - element.style.left = goog.vec.Mat4.getElement(transform, 0, 3) + 'px'; - element.style.top = goog.vec.Mat4.getElement(transform, 1, 3) + 'px'; + element.style.left = Math.round(goog.vec.Mat4.getElement(transform, 0, 3)) + 'px'; + element.style.top = Math.round(goog.vec.Mat4.getElement(transform, 1, 3)) + 'px'; // TODO: Add scaling here. This isn't quite as simple as multiplying // width/height, because that only changes the container size, not the