diff --git a/source/UI/js/Video/ClipPanel.js b/source/UI/js/Video/ClipPanel.js index c06870d5..950600cf 100644 --- a/source/UI/js/Video/ClipPanel.js +++ b/source/UI/js/Video/ClipPanel.js @@ -235,7 +235,7 @@ Ox.ClipPanel = function(options, self) { that.selectClip(); self.$list.gainFocus(); } else if (data.id == 'splitclip') { - // ... + splitClip(); } else if (data.id == 'split') { splitClips(); } else if (data.id == 'join') { @@ -454,6 +454,13 @@ Ox.ClipPanel = function(options, self) { 'delete': function(data) { self.options.editable && that.triggerEvent('delete', data); }, + key_backslash: function(data) { + that.selectClip(); + self.$list.gainFocus(); + }, + key_shift_backslash: function(data) { + splitClip(); + }, move: function(data) { data.ids.forEach(function(id, index) { self.$list.value(id, 'index', index); @@ -586,6 +593,30 @@ Ox.ClipPanel = function(options, self) { self.$list.options({selected: self.options.selected}); } + function splitClip() { + that.selectClip(); + var index; + Ox.forEach(self.options.clips, function(clip, i) { + if (clip.position <= self.options.position) { + index = i + } else { + return false; // break + } + }); + var clip = self.options.clips[index]; + if (clip) { + var position = self.options.position - clip.position + clip['in']; + if (position != clip['in'] && position != clip['out']) { + var ids = [clip.id]; + var split = [ + {'in': clip['in'], 'out': position, 'item': clip.item}, + {'in': position, 'out': clip['out'], 'item': clip.item} + ]; + that.triggerEvent('split', {ids: ids, split: split}); + } + } + } + function splitClips() { var ids = getEditable(self.options.selected).filter(function(id) { var clip = Ox.getObjectById(self.options.clips, id);