fix some info resize bugs

This commit is contained in:
rolux 2011-10-29 13:50:40 +00:00
parent 826e61a2eb
commit f666b7b6d5
3 changed files with 27 additions and 15 deletions

View File

@ -8,8 +8,9 @@ pandora.ui.info = function() {
.css({overflowX: 'hidden', overflowY: 'auto'})
.bindEvent({
toggle: function(data) {
Ox.print('INFO TOGGLE')
pandora.UI.set({showInfo: !data.collapsed});
pandora.resizeFolders();
//pandora.resizeFolders();
},
pandora_find: function() {
if (pandora.user.ui._list != pandora.UI.getPrevious('_list')) {
@ -42,11 +43,16 @@ pandora.ui.info = function() {
}
function resizeInfo() {
var height = pandora.getInfoHeight();
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
pandora.$ui.leftPanel.size(2, height, function() {
var height = pandora.getInfoHeight(true);
Ox.print('RESIZE INFO', ui.showInfo, height)
if (ui.showInfo) {
pandora.$ui.leftPanel.size(2, height, function() {
pandora.resizeFolders();
});
} else {
pandora.$ui.leftPanel.css({bottom: -height});
pandora.resizeFolders();
});
}
}
function updateInfo() {
@ -59,7 +65,7 @@ pandora.ui.info = function() {
} else if (view == 'poster') {
pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) {
var ratio = result.data.posterRatio,
height = pandora.getInfoHeight();
height = pandora.getInfoHeight(true);
that.empty().append(
pandora.$ui.posterInfo = pandora.ui.posterInfo(Ox.extend(result.data, {id: id}))
);
@ -75,7 +81,7 @@ pandora.ui.info = function() {
pandora.$ui.videoPreview = pandora.ui.videoPreview({
duration: result.data.duration,
frameRatio: result.data.videoRatio,
height: pandora.getInfoHeight(),
height: pandora.getInfoHeight(true),
id: id,
width: ui.sidebarSize
})
@ -114,7 +120,7 @@ pandora.ui.info = function() {
pandora.$ui.posterInfo.resizePoster();
} else if (view == 'video') {
pandora.$ui.videoPreview.options({
height: pandora.getInfoHeight(),
height: pandora.getInfoHeight(true),
width: ui.sidebarSize
});
}

View File

@ -23,7 +23,7 @@ pandora.ui.leftPanel = function() {
.bindEvent({
resize: function(data) {
pandora.user.ui.sidebarSize = data.size;
var infoHeight = pandora.getInfoHeight();
var infoHeight = pandora.getInfoHeight(true);
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
pandora.$ui.sectionButtons.removeElement();
delete pandora.$ui.sectionButtons;
@ -33,10 +33,10 @@ pandora.ui.leftPanel = function() {
delete pandora.$ui.sectionSelect;
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
}
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
pandora.$ui.leftPanel.size(2, infoHeight);
pandora.$ui.info.resizeInfo();
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
pandora.resizeFolders();
pandora.$ui.info.resizeInfo();
},
resizeend: function(data) {
// set to 0 so that UI.set registers a change of the value
@ -52,7 +52,7 @@ pandora.ui.leftPanel = function() {
}
},
pandora_showinfo: function(data) {
data.value == that.options('elements')[1].collapsed && that.toggle(1);
data.value == that.options('elements')[2].collapsed && that.toggle(2);
}
});
return that;

View File

@ -483,12 +483,12 @@ pandora.getGroupsSizes = function() {
)
};
pandora.getInfoHeight = function() {
pandora.getInfoHeight = function(includeHidden) {
// fixme: new, check if it can be used more
var isVideoPreview = pandora.user.ui.item || (
pandora.user.ui.listSelection.length && !pandora.isClipView()
);
return pandora.user.ui.showInfo * Math.min(
return (pandora.user.ui.showInfo || includeHidden) * Math.min(
isVideoPreview
? Math.round(pandora.user.ui.sidebarSize / (16/9)) + 16
: pandora.user.ui.sidebarSize,
@ -747,6 +747,7 @@ pandora.resizeFolders = function() {
columnWidth = {user: parseInt((width - 96) * 0.4)};
columnWidth.name = (width - 96) - columnWidth.user;
}
Ox.print('RESIZE FOLDERS', width);
Ox.forEach(pandora.$ui.folderList, function($list, id) {
var pos = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
pandora.$ui.folder[pos].css({width: width + 'px'});
@ -770,8 +771,13 @@ pandora.resizeFolders = function() {
pandora.resizeWindow = function() {
pandora.resizeFolders();
pandora.$ui.leftPanel.size(2, pandora.getInfoHeight());
/*
var infoHeight = pandora.getInfoHeight(true);
pandora.$ui.leftPanel.size(2, infoHeight);
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
pandora.resizeFolders();
pandora.$ui.info.resizeInfo();
*/
if (!pandora.user.ui.item) {
pandora.resizeGroups(pandora.$ui.rightPanel.width());
if (pandora.user.ui.listView == 'clips') {