diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 27d5a831..2ac8afd1 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -66,20 +66,34 @@ pandora.UI = (function() { } // it is important to check for find first, so that if find // 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) { if (Object.keys(listSettings).indexOf(key) > -1) { // 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) { // when switching to an item, update list selection - var list = pandora.user.ui._list || ''; add['listSelection'] = [val]; if (!pandora.user.ui.lists[list]) { add['lists.' + that.encode(list)] = {}; } 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) { // when switching to a video view, add it as default video view add.videoView = val; @@ -96,7 +110,6 @@ pandora.UI = (function() { while (keys.length > 1) { ui = ui[keys.shift()]; } - Ox.print(keys[0]) if (!Ox.isEqual(ui[keys[0]], val)) { if (val === null) { delete ui[keys[0]] diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 4861064d..477336a8 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -124,13 +124,10 @@ pandora.ui.item = function() { return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; }, height: pandora.$ui.contentPanel.size(1), - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item]['in'] : 0, + 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], muted: pandora.user.ui.videoMuted, - out: pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item].out : 0, - position: pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item].position : 0, + out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, + position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, scaleToFill: pandora.user.ui.videoScale == 'fill', showAnnotations: pandora.user.ui.showAnnotations, showControls: pandora.user.ui.showControls, @@ -200,14 +197,11 @@ pandora.ui.item = function() { }, height: pandora.$ui.contentPanel.size(1), id: 'editor', - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item]['in'] : 0, + 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], layers: layers, muted: pandora.user.ui.videoMuted, - out: pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item].out : 0, - position: pandora.user.ui.videoPoints[pandora.user.ui.item] - ? pandora.user.ui.videoPoints[pandora.user.ui.item].position : 0, + out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, + position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, posterFrame: parseInt(video.duration / 2), showAnnotations: pandora.user.ui.showAnnotations, showLargeTimeline: true,