1
0
Fork 0
forked from 0x2620/oxjs

player/timeline: differentiate between drag (positioning event) and dragend (position event), fixes #1657

This commit is contained in:
rlx 2013-08-27 11:38:01 +00:00
commit e93b196e67
5 changed files with 38 additions and 13 deletions

View file

@ -264,6 +264,9 @@ Ox.VideoPanel = function(options, self) {
position: function(data) {
setPosition(data.position);
},
positioning: function(data) {
setPosition(data.position, false, true);
},
resolution: function(data) {
that.triggerEvent('resolution', data);
},
@ -305,7 +308,8 @@ Ox.VideoPanel = function(options, self) {
.css({left: '4px', top: '4px'})
.bindEvent({
mousedown: that.gainFocus,
position: changeTimeline
position: dragendTimeline,
positioning: dragTimeline
})
.appendTo(self.$controls);
@ -422,10 +426,13 @@ Ox.VideoPanel = function(options, self) {
})
);
function changeTimeline(data) {
function dragTimeline(data) {
self.options.position = data.position;
self.$video.options({position: self.options.position});
self.$annotationPanel.options({position: self.options.position});
}
function dragendTimeline() {
that.triggerEvent('position', {position: self.options.position});
}
@ -560,14 +567,14 @@ Ox.VideoPanel = function(options, self) {
}
}
function setPosition(position, playing) {
function setPosition(position, playing, dragging) {
var minute = Math.floor(position / 60),
previousMinute = Math.floor(self.options.position / 60);
self.options.position = position;
!playing && self.$video.options({position: self.options.position});
self.$timeline.options({position: self.options.position});
self.$annotationPanel.options({position: self.options.position});
if (!playing || minute != previousMinute) {
if ((!playing || minute != previousMinute) && !dragging) {
that.triggerEvent('position', {
position: !playing ? self.options.position : minute * 60
});