Bring back private UIDs for Color.

SVG Export for multiple gradients was broken.
This commit is contained in:
Jürg Lehni 2015-06-16 18:12:40 +02:00
parent 4fde7ab37d
commit dbac9c06de
3 changed files with 17 additions and 3 deletions
src/util

View file

@ -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++;
}
}
};