|
685 | 685 | // domNode: undefined |
686 | 686 | // htmlDlyCmdId: undefined |
687 | 687 | // autohideId: undefined |
| 688 | + // lastMousePosition: undefined |
688 | 689 | // cmdsIgnored |
689 | 690 | }, |
690 | 691 | solution: { // Static Object: Defines the solutions built in jPlayer. |
|
2501 | 2502 | event = "mousemove.jPlayer", |
2502 | 2503 | namespace = ".jPlayerAutohide", |
2503 | 2504 | eventType = event + namespace, |
2504 | | - handler = function() { |
| 2505 | + handler = function(sourceEvent) { |
| 2506 | + var mouseMoved = false; |
| 2507 | + if (self.internal.lastMousePosition != undefined) { |
| 2508 | + //get the change from last position to this position |
| 2509 | + var deltaX = self.internal.lastMousePosition.x - sourceEvent.clientX, |
| 2510 | + deltaY = self.internal.lastMousePosition.y - sourceEvent.clientY; |
| 2511 | + mouseMoved = (Math.abs(deltaX)>0) || (Math.abs(deltaY)>0); |
| 2512 | + } else { |
| 2513 | + mouseMoved = true; |
| 2514 | + } |
| 2515 | + // store current position for next method execution |
| 2516 | + self.internal.lastMousePosition = { |
| 2517 | + x : sourceEvent.clientX, |
| 2518 | + y : sourceEvent.clientY |
| 2519 | + }; |
| 2520 | + // if mouse has been actually moved, do the gui fadeIn/fadeOut |
| 2521 | + if (mouseMoved) { |
2505 | 2522 | self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() { |
2506 | 2523 | clearTimeout(self.internal.autohideId); |
2507 | 2524 | self.internal.autohideId = setTimeout( function() { |
2508 | 2525 | self.css.jq.gui.fadeOut(self.options.autohide.fadeOut); |
2509 | 2526 | }, self.options.autohide.hold); |
2510 | 2527 | }); |
| 2528 | + } |
2511 | 2529 | }; |
2512 | 2530 |
|
2513 | 2531 | if(this.css.jq.gui.length) { |
|
2518 | 2536 |
|
2519 | 2537 | // Removes the fadeOut operation from the fadeIn callback. |
2520 | 2538 | clearTimeout(this.internal.autohideId); |
| 2539 | + // undefine lastMousePosition |
| 2540 | + delete this.internal.lastMousePosition; |
2521 | 2541 |
|
2522 | 2542 | this.element.unbind(namespace); |
2523 | 2543 | this.css.jq.gui.unbind(namespace); |
|
0 commit comments