some fixes for preview dialog

This commit is contained in:
rolux 2011-06-07 05:28:29 +00:00
parent af1f7a28c9
commit 881eb58e82

View file

@ -335,10 +335,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument
var documentHeight = pandora.$ui.document.height(), var documentHeight = pandora.$ui.document.height(),
item = result.data.items[0], item = result.data.items[0],
title = item.title + (item.director ? ' (' + item.director + ')' : ''), title = item.title + (item.director ? ' (' + item.director + ')' : ''),
dialogHeight = documentHeight - 100, dialogHeight = documentHeight - 48,
dialogWidth; dialogWidth;
pandora.site.previewRatio = item.poster.width / item.poster.height, pandora.site.previewRatio = item.poster.width / item.poster.height,
dialogWidth = parseInt((dialogHeight - 48) * pandora.site.previewRatio); dialogWidth = Math.round((dialogHeight - 48) * pandora.site.previewRatio);
if ('previewDialog' in pandora.$ui) { if ('previewDialog' in pandora.$ui) {
pandora.$ui.previewDialog.options({ pandora.$ui.previewDialog.options({
title: title title: title
@ -355,7 +355,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
pandora.$ui.previewImage pandora.$ui.previewImage
.css({ .css({
width: dialogWidth + 'px', width: dialogWidth + 'px',
height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ? height: (dialogHeight - 48) + 'px', // fixme: why -2 ?
opacity: 0 opacity: 0
}) })
.animate({ .animate({
@ -373,7 +373,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
.css({ .css({
position: 'absolute', position: 'absolute',
width: dialogWidth + 'px', width: dialogWidth + 'px',
height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ? height: (dialogHeight - 48) + 'px', // fixme: why -2 ?
left: 0, left: 0,
top: 0, top: 0,
right: 0, right: 0,
@ -393,10 +393,11 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}) })
], ],
content: pandora.$ui.previewImage, content: pandora.$ui.previewImage,
focus: false,
height: dialogHeight, height: dialogHeight,
id: 'previewDialog', id: 'previewDialog',
minHeight: pandora.site.previewRatio >= 1 ? 128 / pandora.site.previewRatio + 48 : 176, minHeight: pandora.site.previewRatio >= 1 ? Math.round(128 / pandora.site.previewRatio) + 48 : 176,
minWidth: pandora.site.previewRatio >= 1 ? 128 : 176 * pandora.site.previewRatio, minWidth: pandora.site.previewRatio >= 1 ? 128 : Math.round(176 * pandora.site.previewRatio),
padding: 0, padding: 0,
title: title, title: title,
width: dialogWidth width: dialogWidth
@ -406,10 +407,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument
height, width; height, width;
if (dialogRatio < pandora.site.previewRatio) { if (dialogRatio < pandora.site.previewRatio) {
width = data.width; width = data.width;
height = width / pandora.site.previewRatio; height = Math.round(width / pandora.site.previewRatio);
} else { } else {
height = (data.height - 48 - 2); height = (data.height - 48);
width = height * pandora.site.previewRatio; width = Math.round(height * pandora.site.previewRatio);
} }
pandora.$ui.previewImage.css({ pandora.$ui.previewImage.css({
width: width + 'px', width: width + 'px',