Skip to content

Commit

Permalink
Round CSS offsets to nearest integer
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhyde committed Jan 28, 2014
1 parent 6d2eb91 commit 6a83778
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ol/dom/dom.js
Expand Up @@ -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
Expand Down

0 comments on commit 6a83778

Please sign in to comment.