From 0ecfe1450706cbb05e3f7deafe414970f3cca51a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 22 Jan 2014 18:32:11 +0000 Subject: [PATCH] trim annotations to current clip --- static/js/editPanel.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 54a117a9..a3addaed 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -392,9 +392,14 @@ pandora.ui.editPanel = function() { items: Ox.flatten(clips.map(function(clip) { return clip.layers[layer.id].map(function(annotation) { var a = Ox.clone(annotation); - ['in', 'out'].forEach(function(point) { - a[point] = a[point] - clip['in'] + clip['position']; - }); + a['in'] = Math.max( + clip['position'], + a['in'] - clip['in'] + clip['position'] + ); + a.out = Math.min( + clip['position'] + clip['duration'], + a.out - clip['in'] + clip['position'] + ); return a; }); })),