fix #1998 (Keep documents view find element from disappearing if width gets too small)

This commit is contained in:
rolux 2014-02-17 11:44:16 +00:00
parent cfbeecd21e
commit f710d39567
2 changed files with 19 additions and 1 deletions

View file

@ -396,6 +396,12 @@ pandora.ui.documentsPanel = function(options) {
pandora.$ui.documentsList = $list;
}
// to determine the width of the find input inside
// the documents dialog, that dialog has to be present
setTimeout(function() {
$findInput.options({width: getFindInputWidth()});
});
that.bindEvent(
'pandora_documentsselection.' + (isItemView ? ui.item.toLowerCase() : ''),
selectDocuments
@ -453,6 +459,17 @@ pandora.ui.documentsPanel = function(options) {
return Ox._(ui.documentsSort[0].operator == '+' ? 'Ascending' : 'Descending');
}
function getFindInputWidth() {
// 2 * 128px selects + 2 * 16px buttons + 4 * 4px margins = 304px
return Math.min(192, (
isItemView
? window.innerWidth - (ui.showSidebar * ui.sidebarSize) - 1
- (ui.showDocument * ui.documentSize)
: pandora.$ui.documentsDialog.options('width')
- ui.documentSize - 1
) - 304);
}
function getPreviewSize() {
var ratio = $list.value($list.options('selected')[0], 'ratio'),
size = ui.documentSize - 16 - Ox.UI.SCROLLBAR_SIZE,
@ -895,6 +912,7 @@ pandora.ui.documentsPanel = function(options) {
};
that.updateSize = function() {
$findInput.options({width: getFindInputWidth()});
$list.size();
};

View file

@ -42,7 +42,7 @@ pandora.ui.rightPanel = function() {
} else {
pandora.$ui.browser.scrollToSelection();
if (pandora.user.ui.itemView == 'documents') {
pandora.$ui.documentsList.size();
pandora.$ui.documents.updateSize();
} else if (pandora.user.ui.itemView == 'clips') {
pandora.$ui.clipList.size();
} else if (pandora.user.ui.itemView == 'timeline') {