diff --git a/core-js/Graphics/Render.js b/core-js/Graphics/Render.js index c6e6d5a76..f661ae181 100644 --- a/core-js/Graphics/Render.js +++ b/core-js/Graphics/Render.js @@ -124,7 +124,7 @@ function setPos(pos,e) { case "PositionAt": e.style.top = toPos(pos[2]); e.style.left = toPos(pos[1]); - var shift = "translate(" + (-elem[3]/2) + "px," + (-elem[4]/2) + "px)"; + var shift = "translate(" + ~~(-e.style.width.slice(0,-2) / 2) + "px," + ~~(-e.style.height.slice(0,-2) / 2) + "px)"; e.style.transform = shift; e.style.msTransform = shift; e.style.MozTransform = shift; diff --git a/elm/elm-runtime-0.5.5.js b/elm/elm-runtime-0.5.5.js index 5d996cb7a..553e39eaa 100644 --- a/elm/elm-runtime-0.5.5.js +++ b/elm/elm-runtime-0.5.5.js @@ -2126,9 +2126,11 @@ function setPos(pos,e) { if (pos[2][0] !== "Near") e.style.bottom = 0; break; case "PositionAt": + console.log(toPos(pos[1]),toPos(pos[2])); e.style.top = toPos(pos[2]); e.style.left = toPos(pos[1]); - var shift = "translate(" + (-elem[3]/2) + "px," + (-elem[4]/2) + "px)"; + var shift = "translate(" + ~~(-e.style.width.slice(0,-2) / 2) + "px," + ~~(-e.style.height.slice(0,-2) / 2) + "px)"; + console.log(shift); e.style.transform = shift; e.style.msTransform = shift; e.style.MozTransform = shift;