video player panel: fix in/out/annotation select

This commit is contained in:
rlx 2013-08-06 10:49:54 +00:00
parent fcaa9ab755
commit 709e8d2474

View file

@ -155,7 +155,7 @@ Ox.VideoPanel = function(options, self) {
}, },
key_i: function() { key_i: function() {
self.$annotationPanel.options({selected: ''}); self.$annotationPanel.options({selected: ''});
setPoint('in', self.options.position, true); setPoint('in', self.options.position, false, true);
}, },
key_l: toggleLoop, key_l: toggleLoop,
key_left: function() { key_left: function() {
@ -166,7 +166,7 @@ Ox.VideoPanel = function(options, self) {
}, },
key_o: function() { key_o: function() {
self.$annotationPanel.options({selected: ''}); self.$annotationPanel.options({selected: ''});
setPoint('out', self.options.position, true); setPoint('out', self.options.position, false, true);
}, },
key_p: playInToOut, key_p: playInToOut,
key_right: function() { key_right: function() {
@ -516,8 +516,8 @@ Ox.VideoPanel = function(options, self) {
self.options.selected = data.id; self.options.selected = data.id;
if (self.options.selected) { if (self.options.selected) {
setPosition(data['in']); setPosition(data['in']);
setPoint('in', data['in']); setPoint('in', data['in'], true);
setPoint('out', data.out); setPoint('out', data.out, true);
} }
self.$annotationPanel.options({selected: self.options.selected}); self.$annotationPanel.options({selected: self.options.selected});
that.triggerEvent('select', {id: self.options.selected}); that.triggerEvent('select', {id: self.options.selected});
@ -541,15 +541,17 @@ Ox.VideoPanel = function(options, self) {
setPoint('out', points.out); setPoint('out', points.out);
} }
function setPoint(point, position, triggerEvent) { function setPoint(point, position, keepSelected, triggerEvent) {
self.options[point] = position; self.options[point] = position;
if (self.options.selected && !keepSelected) {
selectAnnotation({id: ''});
}
self.$video.options(point, position); self.$video.options(point, position);
self.$timeline.options(point, position); self.$timeline.options(point, position);
self.$annotationPanel.options(point, position); self.$annotationPanel.options(point, position);
if (self.options['in'] > self.options.out) { if (self.options['in'] > self.options.out) {
setPoint(point == 'in' ? 'out' : 'in', position); setPoint(point == 'in' ? 'out' : 'in', position, keepSelected);
} } else if (triggerEvent) {
if (triggerEvent) {
that.triggerEvent('points', { that.triggerEvent('points', {
'in': self.options['in'], 'in': self.options['in'],
out: self.options.out, out: self.options.out,