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