fix bugs with setting list selection and video points on load

This commit is contained in:
rolux 2011-10-20 11:54:35 +00:00
parent fc81d9de47
commit c836392051
4 changed files with 19 additions and 30 deletions

View file

@ -73,22 +73,12 @@ pandora.UI = (function() {
}
if (key == 'item' && val) {
// when switching to an item, update list selection
var list = pandora.user.ui._list || '';
add['listSelection'] = [val];
add['lists.' + that.encode(pandora.user.ui._list || '') + '.selection'] = [val];
if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {};
}
if ((
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[pandora.user.ui.item]
)) {
// when switching to a video view, add default videoPoints
add['videoPoints.' + (
key == 'item' ? val : pandora.user.ui.item
)] = {'in': 0, out: 0, position: 0};
add['lists.' + that.encode(list) + '.selection'] = [val];
}
if (key == 'itemView' && ['video', 'timeline'].indexOf(val) > -1) {
// when switching to a video view, add it as default video view
@ -97,6 +87,7 @@ pandora.UI = (function() {
});
[args, add].forEach(function(obj, isAdd) {
Ox.forEach(obj, function(val, key) {
Ox.print('key/val', key, val)
// make sure to not split at escaped dots ('\.')
var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) {
return key.replace(/\n/g, '.')
@ -105,6 +96,7 @@ 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]]

View file

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

View file

@ -207,7 +207,6 @@ pandora.ui.list = function() {
.apply(this, Ox.merge([data[sortKey]], format.args || []))
: data[sortKey];
}
Ox.print('CLIPS::', data.clips)
return {
icon: {
height: Math.round(ratio <= 1 ? size : size / ratio),

View file

@ -416,14 +416,6 @@ pandora.exitFullscreen = function() {
pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE);
};
pandora.getClipPoints = function(duration, number) {
var step = Math.max(Math.floor((duration - 5) / 60 / (number + 1)), 1) * 60;
Ox.print('STEP', step)
return Ox.range(step, duration - 4.999, step).map(function(position) {
return {'in': position, 'out': position + 5};
});
};
pandora.getFoldersHeight = function() {
var height = 0;
pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) {