From d41d290ba5d7d0666b26f3e95fdcabb352690e52 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 14 Jul 2013 15:10:19 +0000 Subject: [PATCH] handle clip ids in edit section --- static/js/pandora/editPanel.js | 16 +++++++++++----- static/js/pandora/utils.js | 19 ++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/static/js/pandora/editPanel.js b/static/js/pandora/editPanel.js index d7a14917..50aee4df 100644 --- a/static/js/pandora/editPanel.js +++ b/static/js/pandora/editPanel.js @@ -138,6 +138,9 @@ pandora.ui.editPanel = function() { muted: function(data) { pandora.UI.set('videoMuted', data.muted); }, + open: function(data) { + pandora.UI.set(editPointsKey('clip'), data.ids[0]); + }, paste: function() { if (Ox.Clipboard.type() == 'clip') { pandora.api.addClips({ @@ -150,10 +153,16 @@ pandora.ui.editPanel = function() { } }, playing: function(data) { - pandora.UI.set(editPointsKey('position'), data.position); + var set = {}; + set[editPointsKey('clip')] = ''; + set[editPointsKey('position')] = data.position; + pandora.UI.set(set); }, position: function(data) { - pandora.UI.set(editPointsKey('position'), data.position); + var set = {}; + set[editPointsKey('clip')] = ''; + set[editPointsKey('position')] = data.position; + pandora.UI.set(set); }, remove: function(data) { if (edit.editable) { @@ -179,9 +188,6 @@ pandora.ui.editPanel = function() { scale: function(data) { pandora.UI.set('videoScale', data.scale); }, - select: function(data) { - pandora.UI.set(editPointsKey('clip'), data.ids[0]); - }, size: function(data) { pandora.UI.set('clipSize', data.size); }, diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index e0428fe1..50d3ca2b 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -1168,12 +1168,21 @@ pandora.getSpan = function(state, val, callback) { }); } } else if (state.type == 'edits') { - pandora.api.getEdit({id: state.item, keys: ['duration']}, function(result) { - state.span = val.map(function(number) { - return Math.min(number, result.data.duration); + if (isArray) { + pandora.api.getEdit({id: state.item, keys: ['duration']}, function(result) { + state.span = val.map(function(number) { + return Math.min(number, result.data.duration); + }); + callback(); }); - callback(); - }); + } else { + pandora.api.getEdit({id: state.item, keys: ['clips']}, function(result) { + if (Ox.getObjectById(result.data.clips, val)) { + state.span = val; + } + callback(); + }); + } } else if (state.type == 'texts') { state.span = val; callback();