Skip to content

Commit 7242517

Browse files
committed
made frequency param on enableMouseOver optional
Signed-off-by: Grant Skinner <info@gskinner.com>
1 parent 9c76e9d commit 7242517

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

VERSIONS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Version 0.4.1 [Not released]
33
- fixed a problem with preloading sprite sheet images when using tile based sheets
44
- worked around a bug in Safari with addFlippedFrames
55
- added setChildIndex(), swapChildrenAt(), and swapChildren() to Container
6+
- made frequency param on enableMouseOver optional
67

78

89
Version 0.4 [Nov 30, 2011]

src/easeljs/display/Stage.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,18 @@ var p = Stage.prototype = new Container();
304304
/**
305305
* Enables or disables (by passing a frequency of 0) mouse over handlers (onMouseOver and onMouseOut) for this stage's display
306306
* list. These events can be expensive to generate, so they are disabled by default, and the frequency of the events
307-
* can be controlled independently of mouse move events via the frequency parameter.
307+
* can be controlled independently of mouse move events via the optional frequency parameter.
308308
* @method enableMouseOver
309-
* @param {Number} frequency The maximum number of times per second to broadcast mouse over/out events. Set to 0 to disable mouse
310-
* over events completely. Maximum is 50. A lower frequency is less responsive, but uses less CPU.
309+
* @param {Number} frequency Optional param specifying the maximum number of times per second to broadcast mouse over/out events. Set to 0 to disable mouse
310+
* over events completely. Maximum is 50. A lower frequency is less responsive, but uses less CPU. Default is 20.
311311
**/
312312
p.enableMouseOver = function(frequency) {
313313
if (this._mouseOverIntervalID) {
314314
clearInterval(this._mouseOverIntervalID);
315315
this._mouseOverIntervalID = null;
316316
}
317-
if (frequency <= 0) { return; }
317+
if (frequency == null) { frequency = 20; }
318+
else if (frequency <= 0) { return; }
318319
var o = this;
319320
this._mouseOverIntervalID = setInterval(function(){ o._testMouseOver(); }, 1000/Math.min(50,frequency));
320321
this._mouseOverX = NaN;

0 commit comments

Comments
 (0)