mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-08 10:44:30 -04:00
Bring back private UIDs for Color.
SVG Export for multiple gradients was broken.
This commit is contained in:
parent
4fde7ab37d
commit
dbac9c06de
3 changed files with 17 additions and 3 deletions
src/util
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
var UID = {
|
||||
_id: 1,
|
||||
_pools: {},
|
||||
|
||||
/**
|
||||
* Returns the next unique id.
|
||||
|
@ -24,7 +25,17 @@ var UID = {
|
|||
* @return {Number} The next unique id
|
||||
* @static
|
||||
**/
|
||||
get: function() {
|
||||
return this._id++;
|
||||
get: function(ctor) {
|
||||
if (ctor) {
|
||||
// Use one UID pool per given constructor
|
||||
var name = ctor._class,
|
||||
pool = this._pools[name];
|
||||
if (!pool)
|
||||
pool = this._pools[name] = { _id: 1 };
|
||||
return pool._id++;
|
||||
} else {
|
||||
// Use the global UID pool:
|
||||
return this._id++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue