mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -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# */{
|
var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{
|
||||||
_type: 'placedsymbol',
|
_type: 'placedsymbol',
|
||||||
|
_serializeFields: {
|
||||||
|
symbol: null
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Creates a new PlacedSymbol Item.
|
* Creates a new PlacedSymbol Item.
|
||||||
*
|
*
|
||||||
|
|
|
@ -68,6 +68,11 @@ var Symbol = this.Symbol = Base.extend(/** @lends Symbol# */{
|
||||||
this._instances = {};
|
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#remove()
|
||||||
// TODO: Symbol#name (accessible by name through project#symbols)
|
// TODO: Symbol#name (accessible by name through project#symbols)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue