From 262402305a48e1d992e60a3760b9f28e941c35c5 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 14 Jul 2013 18:57:31 +0000 Subject: [PATCH] handle copy from edit list --- static/js/pandora/editPanel.js | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/static/js/pandora/editPanel.js b/static/js/pandora/editPanel.js index 6961fa4d5..e7c20a881 100644 --- a/static/js/pandora/editPanel.js +++ b/static/js/pandora/editPanel.js @@ -14,7 +14,7 @@ pandora.ui.editPanel = function() { smallTimelineContext, that = Ox.Element(); - ui.edit ? render() : renderOverview(); + ui.edit ? renderEdit() : renderEdits(); function editPointsKey(key) { return 'editPoints.' + ui.edit.replace(/\./g, '\\.') + '.' + key; @@ -39,7 +39,7 @@ pandora.ui.editPanel = function() { return videos; } - function render() { + function renderEdit() { pandora.api.getEdit({id: ui.edit}, function(result) { edit = result.data; // fixme: duration should come from backend @@ -98,10 +98,12 @@ pandora.ui.editPanel = function() { }) .bindEvent({ copy: function(data) { - + Ox.Clipboard.copy(data.ids.map(function(id) { + return Ox.getObjectById(edit.clips, id); + }), 'clip'); }, cut: function(data) { - + // ... }, edit: function(data) { var args = {id: data.id}, @@ -255,7 +257,8 @@ pandora.ui.editPanel = function() { updateSmallTimelineURL(); }); } - function renderOverview() { + + function renderEdits() { that = Ox.IconList({ borderRadius: 16, defaultRatio: 1, @@ -312,23 +315,8 @@ pandora.ui.editPanel = function() { video: getVideos() }); updateSmallTimelineURL(); - } - function updateVideos() { - edit.duration = 0; - edit.clips.forEach(function(clip) { - clip.position = edit.duration; - edit.duration += clip.duration; - }); - that.options({ - smallTimelineURL: getSmallTimelineURL(), - video: getVideos() - }); - updateSmallTimelineURL(); - } - - function updateSmallTimelineURL() { var fps = 25; Ox.serialForEach(edit.clips, function(clip) { @@ -349,6 +337,19 @@ pandora.ui.editPanel = function() { }); } + function updateVideos() { + edit.duration = 0; + edit.clips.forEach(function(clip) { + clip.position = edit.duration; + edit.duration += clip.duration; + }); + that.options({ + smallTimelineURL: getSmallTimelineURL(), + video: getVideos() + }); + updateSmallTimelineURL(); + } + return that; };