Skip to content

Commit 9c76e9d

Browse files
committed
Made cacheID unique across DisplayObject instances.
Signed-off-by: Grant Skinner <info@gskinner.com>
1 parent d4c3c50 commit 9c76e9d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/easeljs/display/DisplayObject.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ var p = DisplayObject.prototype;
7575
**/
7676
DisplayObject._hitTestContext = DisplayObject._hitTestCanvas.getContext("2d");
7777

78+
/**
79+
* @property _nextCacheID
80+
* @type Number
81+
* @static
82+
* @protected
83+
**/
84+
DisplayObject._nextCacheID = 1;
7885

7986
/**
8087
* The alpha (transparency) for this display object. 0 is fully transparent, 1 is fully opaque.
@@ -423,7 +430,7 @@ var p = DisplayObject.prototype;
423430
this._cacheOffsetX = x;
424431
this._cacheOffsetY = y;
425432
this._applyFilters();
426-
this.cacheID++;
433+
this.cacheID = DisplayObject._nextCacheID++;
427434
}
428435

429436
/**
@@ -444,7 +451,7 @@ var p = DisplayObject.prototype;
444451
this.draw(ctx, true);
445452
if (compositeOperation) { ctx.globalCompositeOperation = "source-over"; }
446453
this._applyFilters();
447-
this.cacheID++;
454+
this.cacheID = DisplayObject._nextCacheID++;
448455
}
449456

450457
/**
@@ -453,7 +460,7 @@ var p = DisplayObject.prototype;
453460
**/
454461
p.uncache = function() {
455462
this._cacheDataURL = this.cacheCanvas = null;
456-
this._cacheOffsetX = this._cacheOffsetY = 0;
463+
this.cacheID = this._cacheOffsetX = this._cacheOffsetY = 0;
457464
}
458465

459466
/**

0 commit comments

Comments
 (0)