mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Use JSON dictionary support to serialize Symbols and PlacedSymbol references.
This commit is contained in:
parent
00dcd05549
commit
e7bb334c6a
2 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,9 @@
|
|||
*/
|
||||
var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{
|
||||
_type: 'placedsymbol',
|
||||
_serializeFields: {
|
||||
symbol: null
|
||||
},
|
||||
/**
|
||||
* Creates a new PlacedSymbol Item.
|
||||
*
|
||||
|
|
|
@ -68,6 +68,11 @@ var Symbol = this.Symbol = Base.extend(/** @lends Symbol# */{
|
|||
this._instances = {};
|
||||
},
|
||||
|
||||
_serialize: function(dictionary) {
|
||||
return dictionary.get(this) || dictionary.set(this, [this._type,
|
||||
Base.serialize(this._definition, false, dictionary)]);
|
||||
},
|
||||
|
||||
// TODO: Symbol#remove()
|
||||
// TODO: Symbol#name (accessible by name through project#symbols)
|
||||
|
||||
|
|
Loading…
Reference in a new issue