Fix the middleAt function.

This commit is contained in:
evancz 2012-11-25 14:19:14 -08:00
parent fb3acd701a
commit 87eaa915c8
2 changed files with 4 additions and 2 deletions

View file

@ -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;

View file

@ -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;