documents panel: proper live resize for item

This commit is contained in:
rolux 2014-01-16 02:22:59 +00:00
parent 9bbefac9f8
commit a2d5f74a91

View file

@ -351,14 +351,12 @@ pandora.ui.documentsPanel = function(options) {
.bindEvent({
resize: function(data) {
ui.documentSize = data.size;
//fixme: resize preview panel
resizeItem();
},
resizeend: function(data) {
// set to 0 so that UI.set registers a change of the value
ui.documentSize = 0;
pandora.UI.set({documentSize: data.size});
//fixme: resize preview panel instead
selectDocuments();
},
toggle: function(data) {
pandora.UI.set({showDocument: !data.collapsed});
@ -711,6 +709,18 @@ pandora.ui.documentsPanel = function(options) {
});
}
function resizeItem() {
var inputWidth = ui.documentSize - 16 - Ox.UI.SCROLLBAR_SIZE,
previewSize = getPreviewSize();
$preview.options({
height: previewSize.height,
width: previewSize.width
});
$form.options('items').forEach(function($item) {
$item.options({width: inputWidth});
});
}
function selectDocuments() {
var selected = ui.documentsSelection[isItemView ? ui.item : ''] || [],
string = selected.length < 2 ? 'Document'