|
704 | 704 | // domNode: undefined
|
705 | 705 | // htmlDlyCmdId: undefined
|
706 | 706 | // autohideId: undefined
|
| 707 | + // mouse: undefined |
707 | 708 | // cmdsIgnored
|
708 | 709 | },
|
709 | 710 | solution: { // Static Object: Defines the solutions built in jPlayer.
|
|
2583 | 2584 | event = "mousemove.jPlayer",
|
2584 | 2585 | namespace = ".jPlayerAutohide",
|
2585 | 2586 | eventType = event + namespace,
|
2586 |
| - handler = function() { |
2587 |
| - self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() { |
2588 |
| - clearTimeout(self.internal.autohideId); |
2589 |
| - self.internal.autohideId = setTimeout( function() { |
2590 |
| - self.css.jq.gui.fadeOut(self.options.autohide.fadeOut); |
2591 |
| - }, self.options.autohide.hold); |
2592 |
| - }); |
| 2587 | + handler = function(event) { |
| 2588 | + var moved = false, |
| 2589 | + deltaX, deltaY; |
| 2590 | + if(typeof self.internal.mouse !== "undefined") { |
| 2591 | + //get the change from last position to this position |
| 2592 | + deltaX = self.internal.mouse.x - event.pageX; |
| 2593 | + deltaY = self.internal.mouse.y - event.pageY; |
| 2594 | + moved = (Math.floor(deltaX) > 0) || (Math.floor(deltaY)>0); |
| 2595 | + } else { |
| 2596 | + moved = true; |
| 2597 | + } |
| 2598 | + // store current position for next method execution |
| 2599 | + self.internal.mouse = { |
| 2600 | + x : event.pageX, |
| 2601 | + y : event.pageY |
| 2602 | + }; |
| 2603 | + // if mouse has been actually moved, do the gui fadeIn/fadeOut |
| 2604 | + if (moved) { |
| 2605 | + self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() { |
| 2606 | + clearTimeout(self.internal.autohideId); |
| 2607 | + self.internal.autohideId = setTimeout( function() { |
| 2608 | + self.css.jq.gui.fadeOut(self.options.autohide.fadeOut); |
| 2609 | + }, self.options.autohide.hold); |
| 2610 | + }); |
| 2611 | + } |
2593 | 2612 | };
|
2594 | 2613 |
|
2595 | 2614 | if(this.css.jq.gui.length) {
|
|
2600 | 2619 |
|
2601 | 2620 | // Removes the fadeOut operation from the fadeIn callback.
|
2602 | 2621 | clearTimeout(this.internal.autohideId);
|
| 2622 | + // undefine mouse |
| 2623 | + delete this.internal.mouse; |
2603 | 2624 |
|
2604 | 2625 | this.element.unbind(namespace);
|
2605 | 2626 | this.css.jq.gui.unbind(namespace);
|
|
0 commit comments