edit panel: add updatePanel method

This commit is contained in:
rolux 2013-08-09 13:45:51 +00:00
parent e7cbb9cf82
commit 5ead7f75f4

View file

@ -14,7 +14,7 @@ pandora.ui.editPanel = function() {
smallTimelineContext,
that = Ox.Element();
ui.edit ? renderEdit() : renderEdits();
ui.edit ? getEdit(renderEdit) : renderEdits();
function editsKey(key) {
return 'edits.' + ui.edit.replace(/\./g, '\\.') + '.' + key;
@ -33,6 +33,19 @@ pandora.ui.editPanel = function() {
});
}
function getEdit(callback) {
pandora.api.getEdit({id: ui.edit}, function(result) {
edit = result.data;
// fixme: duration should come from backend
edit.duration = 0;
edit.clips.forEach(function(clip) {
clip.position = edit.duration;
edit.duration += clip.duration;
});
callback();
});
}
function getSmallTimelineURL() {
var fps = 25,
width = Math.floor(edit.duration * fps),
@ -53,16 +66,6 @@ pandora.ui.editPanel = function() {
}
function renderEdit() {
pandora.api.getEdit({id: ui.edit}, function(result) {
edit = result.data;
// fixme: duration should come from backend
edit.duration = 0;
edit.clips.forEach(function(clip) {
clip.position = edit.duration;
edit.duration += clip.duration;
});
updateSmallTimelineURL();
pandora.$ui.mainPanel.replaceElement(1,
that = pandora.$ui.editPanel = Ox.VideoEditPanel({
clips: Ox.clone(edit.clips),
clipSize: listSize,
@ -290,10 +293,18 @@ pandora.ui.editPanel = function() {
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
}
})
);
ui.edits[ui.edit].view == 'grid' && enableDragAndDrop();
});
that.updatePanel = function() {
getEdit(function() {
that.options({
clips: edit.clips,
duration: edit.duration
});
});
};
pandora.$ui.mainPanel.replaceElement(1, that);
updateSmallTimelineURL();
ui.edits[ui.edit].view == 'grid' && enableDragAndDrop();
}
function renderEdits() {