fix bugs with setting video points on load

This commit is contained in:
rolux 2011-10-20 12:20:26 +00:00
parent c836392051
commit c0273eac2d
2 changed files with 22 additions and 15 deletions

View file

@ -66,20 +66,34 @@ pandora.UI = (function() {
} }
// it is important to check for find first, so that if find // it is important to check for find first, so that if find
// changes list, pandora.user.ui._list is correct here // changes list, pandora.user.ui._list is correct here
var item = args['item'] || pandora.user.ui.item,
list = pandora.user.ui._list || '';
Ox.print('item/list', item, list, '...', args['videoPoints.' + item])
Ox.forEach(args, function(val, key) { Ox.forEach(args, function(val, key) {
if (Object.keys(listSettings).indexOf(key) > -1) { if (Object.keys(listSettings).indexOf(key) > -1) {
// if applicable, copy setting to list setting // if applicable, copy setting to list setting
add['lists.' + that.encode(pandora.user.ui._list || '') + '.' + listSettings[key]] = val; add['lists.' + that.encode(list) + '.' + listSettings[key]] = val;
} }
if (key == 'item' && val) { if (key == 'item' && val) {
// when switching to an item, update list selection // when switching to an item, update list selection
var list = pandora.user.ui._list || '';
add['listSelection'] = [val]; add['listSelection'] = [val];
if (!pandora.user.ui.lists[list]) { if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {}; add['lists.' + that.encode(list)] = {};
} }
add['lists.' + that.encode(list) + '.selection'] = [val]; add['lists.' + that.encode(list) + '.selection'] = [val];
} }
if (!args['videoPoints.' + item] && ((
key == 'item'
&& ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1
&& !pandora.user.ui.videoPoints[val]
) || (
key == 'itemView'
&& ['video', 'timeline'].indexOf(val) > -1
&& !pandora.user.ui.videoPoints[item]
))) {
// when switching to a video view, add default videoPoints
add['videoPoints.' + item] = {'in': 0, out: 0, position: 0};
}
if (key == 'itemView' && ['video', 'timeline'].indexOf(val) > -1) { if (key == 'itemView' && ['video', 'timeline'].indexOf(val) > -1) {
// when switching to a video view, add it as default video view // when switching to a video view, add it as default video view
add.videoView = val; add.videoView = val;
@ -96,7 +110,6 @@ pandora.UI = (function() {
while (keys.length > 1) { while (keys.length > 1) {
ui = ui[keys.shift()]; ui = ui[keys.shift()];
} }
Ox.print(keys[0])
if (!Ox.isEqual(ui[keys[0]], val)) { if (!Ox.isEqual(ui[keys[0]], val)) {
if (val === null) { if (val === null) {
delete ui[keys[0]] delete ui[keys[0]]

View file

@ -124,13 +124,10 @@ pandora.ui.item = function() {
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
'in': pandora.user.ui.videoPoints[pandora.user.ui.item] 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'],
? pandora.user.ui.videoPoints[pandora.user.ui.item]['in'] : 0,
muted: pandora.user.ui.videoMuted, muted: pandora.user.ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item] out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
? pandora.user.ui.videoPoints[pandora.user.ui.item].out : 0, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
position: pandora.user.ui.videoPoints[pandora.user.ui.item]
? pandora.user.ui.videoPoints[pandora.user.ui.item].position : 0,
scaleToFill: pandora.user.ui.videoScale == 'fill', scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls, showControls: pandora.user.ui.showControls,
@ -200,14 +197,11 @@ pandora.ui.item = function() {
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
id: 'editor', id: 'editor',
'in': pandora.user.ui.videoPoints[pandora.user.ui.item] 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'],
? pandora.user.ui.videoPoints[pandora.user.ui.item]['in'] : 0,
layers: layers, layers: layers,
muted: pandora.user.ui.videoMuted, muted: pandora.user.ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item] out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
? pandora.user.ui.videoPoints[pandora.user.ui.item].out : 0, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
position: pandora.user.ui.videoPoints[pandora.user.ui.item]
? pandora.user.ui.videoPoints[pandora.user.ui.item].position : 0,
posterFrame: parseInt(video.duration / 2), posterFrame: parseInt(video.duration / 2),
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true, showLargeTimeline: true,