Fix size calculations based on #background size, not window

This commit is contained in:
Victor 2015-12-15 14:16:14 +02:00
parent 06bab359e4
commit 5d51dc48b6

View File

@ -152,7 +152,7 @@ Views.prototype.sprite = function (whoid, params, position, alias, effect) {
} else {
//if (this.useSpriteTransitions) img = new AnimatableImageView(this);
//else img = new ImageView(this);
img = $('<img>', {class: "sprite", style: "height: " + window.innerHeight + "px;" });
img = $('<img>', {class: "sprite", style: "height: " + $('#background').outerHeight(true) + "px;" });
this.spriteInContainer[key] = img;
}
var path = PathResolver.sprite(whoid, params);
@ -205,7 +205,7 @@ Views.prototype.hide = function (whoid, effect) {
};
Views.prototype.setSpritePosition = function (img, position) {
var width = window.innerWidth;
var width = $('#background').outerWidth(true);
var imgWidth = img.width();
if (TextUtils.isEmpty(position) || position.equals("center")) {
img.css("left", Math.floor(width / 2 - imgWidth / 2) + "px");