Implement unique ids, and fix issue with Base.deserialize()

Gradient and Symbol were overriding each other in the dictionary, and dictionary entries could not contain references to other dictionary entries.

Closes 
This commit is contained in:
Jürg Lehni 2015-05-11 19:39:39 +02:00
parent 783d1622b9
commit 27bb8a356f
9 changed files with 64 additions and 23 deletions
src/util

30
src/util/UID.js Normal file
View file

@ -0,0 +1,30 @@
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
/**
* @name UID
* @namespace
* @private
*/
var UID = {
_id: 1,
/**
* Returns the next unique id.
* @method get
* @return {Number} The next unique id
* @static
**/
get: function() {
return this._id++;
}
};