make number of clips in clips view dynamic

This commit is contained in:
rolux 2011-10-20 16:49:01 +00:00
parent 43b11a4fe7
commit 19d390e561
5 changed files with 42 additions and 6 deletions

View file

@ -174,8 +174,24 @@ Ox.load({
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 == 'timelines') { if (pandora.user.ui.listView == 'clips') {
pandora.$ui.list.options({width: window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1}); var clipsItems = pandora.getClipsItems();
previousClipsItems = pandora.getClipsItems(pandora.$ui.list.options('width'));
pandora.$ui.list.options({
width: window.innerWidth
- pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1
- Ox.UI.SCROLLBAR_SIZE
});
if (clipsItems != previousClipsItems) {
Ox.Request.clearCache(); // fixme
pandora.$ui.list.reloadList(true);
}
} else if (pandora.user.ui.listView == 'timelines') {
pandora.$ui.list.options({
width: window.innerWidth
- pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1
- Ox.UI.SCROLLBAR_SIZE
});
} else if (pandora.user.ui.listView == 'map') { } else if (pandora.user.ui.listView == 'map') {
pandora.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();
} else if (pandora.user.ui.listView == 'calendar') { } else if (pandora.user.ui.listView == 'calendar') {

View file

@ -39,7 +39,9 @@ pandora.ui.itemClips = function(options) {
.addClass('OxInfoIcon') .addClass('OxInfoIcon')
.css({ .css({
float: 'left', float: 'left',
margin: '2px' margin: i == 0 ? '2px 2px 2px -2px'
: i == self.options.clips.length - 1 ? '2px -2px 2px 2px'
: '2px'
}) })
.data({'in': clip['in'], out: clip.out}); .data({'in': clip['in'], out: clip.out});
$item.$element.find('.OxTarget').addClass('OxSpecialTarget'); $item.$element.find('.OxTarget').addClass('OxSpecialTarget');

View file

@ -233,7 +233,7 @@ pandora.ui.list = function() {
query: pandora.user.ui.find, query: pandora.user.ui.find,
clips: { clips: {
query: pandora.getClipsQuery(), query: pandora.getClipsQuery(),
items: 5, items: pandora.getClipsItems(),
keys: [] keys: []
} }
}), callback); }), callback);
@ -242,7 +242,10 @@ pandora.ui.list = function() {
selected: pandora.user.ui.listSelection, selected: pandora.user.ui.listSelection,
size: 192, size: 192,
sort: pandora.user.ui.listSort, sort: pandora.user.ui.listSort,
unique: 'id' unique: 'id',
width: window.innerWidth
- pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1
- Ox.UI.SCROLLBAR_SIZE
}) })
.bindEvent({ .bindEvent({
key_left: function() { key_left: function() {

View file

@ -25,7 +25,15 @@ pandora.ui.rightPanel = function() {
if (!pandora.user.ui.item) { if (!pandora.user.ui.item) {
pandora.resizeGroups(); pandora.resizeGroups();
pandora.$ui.list.size(); pandora.$ui.list.size();
if (pandora.user.ui.listView == 'timelines') { if (pandora.user.ui.listView == 'clips') {
var clipsItems = pandora.getClipsItems();
previousClipsItems = pandora.getClipsItems(pandora.$ui.list.options('width'));
pandora.$ui.list.options({width: data.size});
if (clipsItems != previousClipsItems) {
Ox.Request.clearCache(); // fixme
pandora.$ui.list.reloadList(true);
}
} else if (pandora.user.ui.listView == 'timelines') {
pandora.$ui.list.options({width: data.size}); pandora.$ui.list.options({width: data.size});
} else if (pandora.user.ui.listView == 'map') { } else if (pandora.user.ui.listView == 'map') {
pandora.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();

View file

@ -416,6 +416,13 @@ pandora.exitFullscreen = function() {
pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE);
}; };
pandora.getClipsItems = function(width) {
width = width || window.innerWidth
- pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1
- Ox.UI.SCROLLBAR_SIZE;
return Math.floor((width - 8) / (128 + 8)) - 1;
};
pandora.getClipsQuery = function() { pandora.getClipsQuery = function() {
function addClipsConditions(conditions) { function addClipsConditions(conditions) {
conditions.forEach(function(condition) { conditions.forEach(function(condition) {