fix a bug that would lead to multiple views appearing on top of each other in the info panel

This commit is contained in:
rolux 2011-11-07 20:20:18 +00:00
parent f75fc026ba
commit 4245a776ed

View file

@ -67,12 +67,14 @@ pandora.ui.info = function() {
previousView = view; previousView = view;
view = getView(); view = getView();
if (view == 'list') { if (view == 'list') {
pandora.$ui.listInfo && pandora.$ui.listInfo.remove();
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo()); that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo());
previousView == 'video' && resizeInfo(); previousView == 'video' && resizeInfo();
} 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(true); height = pandora.getInfoHeight(true);
pandora.$ui.posterInfo && pandora.$ui.posterInfo.remove();
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}))
); );
@ -85,34 +87,35 @@ pandora.ui.info = function() {
}, function(result) { }, function(result) {
if (result.data && result.data.rendered) { if (result.data && result.data.rendered) {
pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove(); pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove();
pandora.$ui.videoPreview = pandora.ui.videoPreview({ that.empty().append(
duration: result.data.duration, pandora.$ui.videoPreview = pandora.ui.videoPreview({
frameRatio: result.data.videoRatio, duration: result.data.duration,
height: pandora.getInfoHeight(true), frameRatio: result.data.videoRatio,
id: id, height: pandora.getInfoHeight(true),
width: ui.sidebarSize id: id,
}) width: ui.sidebarSize
.bindEvent({ })
click: function(data) { .bindEvent({
pandora.UI.set( click: function(data) {
'videoPoints.' + id, pandora.UI.set(
{'in': 0, out: 0, position: data.position} 'videoPoints.' + id,
); {'in': 0, out: 0, position: data.position}
if (ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1) { );
pandora.$ui[ if (ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1) {
ui.itemView == 'video' ? 'player' : 'editor' pandora.$ui[
].options({ ui.itemView == 'video' ? 'player' : 'editor'
position: data.position ].options({
}); position: data.position
} else { });
pandora.UI.set({ } else {
item: id, pandora.UI.set({
itemView: ui.videoView item: id,
}); itemView: ui.videoView
});
}
} }
} })
}) );
.appendTo(pandora.$ui.info);
previousView != 'video' && resizeInfo(); previousView != 'video' && resizeInfo();
} }
}); });