From ba948352c4cda004908fc0258afc6cd6a8361564 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 27 Dec 2015 22:20:06 +0200 Subject: [PATCH] Fix sprite positions --- public_html/js/Views.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/public_html/js/Views.js b/public_html/js/Views.js index 923e9e5..3a911f8 100644 --- a/public_html/js/Views.js +++ b/public_html/js/Views.js @@ -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"); } };