Filter out deserialized dictionary in Base.deserialize()

Closes #637
This commit is contained in:
Jürg Lehni 2015-02-28 19:02:51 +01:00
parent 2002c4a3af
commit 48bc34b21f
2 changed files with 8 additions and 4 deletions

View file

@ -393,7 +393,8 @@ Base.inject(/** @lends Base# */{
* first
*/
deserialize: function(json, create, _data) {
var res = json;
var res = json,
isRoot = !_data;
// A _data side-car to deserialize that can hold any kind of
// 'global' data across a deserialization. It's currently only used
// to hold dictionary definitions.
@ -438,7 +439,10 @@ Base.inject(/** @lends Base# */{
for (var key in json)
res[key] = Base.deserialize(json[key], create, _data);
}
return res;
// Filter out deserialized dictionary.
return isRoot && json && json.length && json[0][0] === 'dictionary'
? res[1]
: res;
},
exportJSON: function(obj, options) {

View file

@ -1172,10 +1172,10 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
return this._applyMatrix;
},
setApplyMatrix: function(transform) {
setApplyMatrix: function(apply) {
// Tell #transform() to apply the internal matrix if _applyMatrix
// can be set to true.
if (this._applyMatrix = this._canApplyMatrix && !!transform)
if (this._applyMatrix = this._canApplyMatrix && !!apply)
this.transform(null, true);
},