Fix sprite positions

This commit is contained in:
Victor 2015-12-27 22:20:06 +02:00
parent d683cbf0a5
commit ba948352c4

View File

@ -218,18 +218,25 @@ Views.prototype.setSpritePosition = function (img, position) {
var width = $('#background').outerWidth(true);
var imgWidth = img.width();
if (TextUtils.isEmpty(position) || position.equals("center")) {
img.css("right", "auto");
img.css("left", Math.floor(width / 2 - imgWidth / 2) + "px");
} else if (position.equals("left")) {
img.css("left", Math.floor(imgWidth / 6) + "px");
} else if (position.equals("cleft")) {
img.css("right", "auto");
img.css("left", Math.floor(width / 2 - imgWidth + imgWidth / 8) + "px");
} else if (position.equals("cleft")) {
img.css("right", "auto");
img.css("left", Math.floor(imgWidth / 6) + "px");
} else if (position.equals("right")) {
img.css("right", Math.floor(imgWidth / 6) + "px");
} else if (position.equals("cright")) {
img.css("left", "auto");
img.css("right", Math.floor(width / 2 - imgWidth + imgWidth / 8) + "px");
} else if (position.equals("cright")) {
img.css("left", "auto");
img.css("right", Math.floor(imgWidth / 6) + "px");
} else if (position.equals("fleft")) {
img.css("right", "auto");
img.css("left", Math.floor(-imgWidth / 4) + "px");
} else if (position.equals("fright")) {
img.css("left", "auto");
img.css("right", Math.floor(-imgWidth / 4) + "px");
}
};