Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for wrong mousemove event on Chrome browser #217

Merged
merged 1 commit into from
Nov 20, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion jquery.jplayer/jquery.jplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@
// domNode: undefined
// htmlDlyCmdId: undefined
// autohideId: undefined
// lastMousePosition: undefined
// cmdsIgnored
},
solution: { // Static Object: Defines the solutions built in jPlayer.
Expand Down Expand Up @@ -2501,13 +2502,30 @@
event = "mousemove.jPlayer",
namespace = ".jPlayerAutohide",
eventType = event + namespace,
handler = function() {
handler = function(sourceEvent) {
var mouseMoved = false;
if (self.internal.lastMousePosition != undefined) {
//get the change from last position to this position
var deltaX = self.internal.lastMousePosition.x - sourceEvent.clientX,
deltaY = self.internal.lastMousePosition.y - sourceEvent.clientY;
mouseMoved = (Math.abs(deltaX)>0) || (Math.abs(deltaY)>0);
} else {
mouseMoved = true;
}
// store current position for next method execution
self.internal.lastMousePosition = {
x : sourceEvent.clientX,
y : sourceEvent.clientY
};
// if mouse has been actually moved, do the gui fadeIn/fadeOut
if (mouseMoved) {
self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() {
clearTimeout(self.internal.autohideId);
self.internal.autohideId = setTimeout( function() {
self.css.jq.gui.fadeOut(self.options.autohide.fadeOut);
}, self.options.autohide.hold);
});
}
};

if(this.css.jq.gui.length) {
Expand All @@ -2518,6 +2536,8 @@

// Removes the fadeOut operation from the fadeIn callback.
clearTimeout(this.internal.autohideId);
// undefine lastMousePosition
delete this.internal.lastMousePosition;

this.element.unbind(namespace);
this.css.jq.gui.unbind(namespace);
Expand Down