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

View file

@ -23,7 +23,7 @@ pandora.ui.leftPanel = function() {
.bindEvent({ .bindEvent({
resize: function(data) { resize: function(data) {
pandora.user.ui.sidebarSize = data.size; pandora.user.ui.sidebarSize = data.size;
var infoHeight = pandora.getInfoHeight(); var infoHeight = pandora.getInfoHeight(true);
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) { if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
pandora.$ui.sectionButtons.removeElement(); pandora.$ui.sectionButtons.removeElement();
delete pandora.$ui.sectionButtons; delete pandora.$ui.sectionButtons;
@ -33,10 +33,10 @@ pandora.ui.leftPanel = function() {
delete pandora.$ui.sectionSelect; delete pandora.$ui.sectionSelect;
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons()); 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.leftPanel.size(2, infoHeight);
pandora.$ui.info.resizeInfo(); !pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
pandora.resizeFolders(); pandora.resizeFolders();
pandora.$ui.info.resizeInfo();
}, },
resizeend: function(data) { resizeend: function(data) {
// set to 0 so that UI.set registers a change of the value // 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) { 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; 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 // fixme: new, check if it can be used more
var isVideoPreview = pandora.user.ui.item || ( var isVideoPreview = pandora.user.ui.item || (
pandora.user.ui.listSelection.length && !pandora.isClipView() pandora.user.ui.listSelection.length && !pandora.isClipView()
); );
return pandora.user.ui.showInfo * Math.min( return (pandora.user.ui.showInfo || includeHidden) * Math.min(
isVideoPreview isVideoPreview
? Math.round(pandora.user.ui.sidebarSize / (16/9)) + 16 ? Math.round(pandora.user.ui.sidebarSize / (16/9)) + 16
: pandora.user.ui.sidebarSize, : pandora.user.ui.sidebarSize,
@ -747,6 +747,7 @@ pandora.resizeFolders = function() {
columnWidth = {user: parseInt((width - 96) * 0.4)}; columnWidth = {user: parseInt((width - 96) * 0.4)};
columnWidth.name = (width - 96) - columnWidth.user; columnWidth.name = (width - 96) - columnWidth.user;
} }
Ox.print('RESIZE FOLDERS', width);
Ox.forEach(pandora.$ui.folderList, function($list, id) { Ox.forEach(pandora.$ui.folderList, function($list, id) {
var pos = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id); var pos = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
pandora.$ui.folder[pos].css({width: width + 'px'}); pandora.$ui.folder[pos].css({width: width + 'px'});
@ -770,8 +771,13 @@ pandora.resizeFolders = function() {
pandora.resizeWindow = function() { pandora.resizeWindow = function() {
pandora.resizeFolders(); 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(); pandora.$ui.info.resizeInfo();
*/
if (!pandora.user.ui.item) { if (!pandora.user.ui.item) {
pandora.resizeGroups(pandora.$ui.rightPanel.width()); pandora.resizeGroups(pandora.$ui.rightPanel.width());
if (pandora.user.ui.listView == 'clips') { if (pandora.user.ui.listView == 'clips') {