Added TextStyle.toJSON and merged the output with Text.toJSON.

This commit is contained in:
Richard Davey 2017-04-25 18:24:37 +01:00
parent ad0ff4d64b
commit a4dc2d28aa
3 changed files with 14 additions and 5 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '03e0ccd0-29d0-11e7-a448-d72a056ead60'
build: 'bfbd2470-29db-11e7-accb-61302486ad25'
};
module.exports = CHECKSUM;

View file

@ -1,5 +1,4 @@
var Class = require('../../utils/Class');
// var GetObjectValue = require('../../utils/object/GetObjectValue');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var MeasureText = require('./MeasureText');
@ -56,7 +55,6 @@ var TextStyle = new Class({
{
for (var key in propertyMap)
{
// this[key] = GetObjectValue(style, propertyMap[key][0], this[key]);
this[key] = GetAdvancedValue(style, propertyMap[key][0], this[key]);
}
}
@ -124,7 +122,6 @@ var TextStyle = new Class({
{
for (var key in propertyMap)
{
// this[key] = GetObjectValue(style, propertyMap[key][0], this[key]);
this[key] = GetAdvancedValue(style, propertyMap[key][0], this[key]);
}
@ -268,6 +265,18 @@ var TextStyle = new Class({
return this.update(false);
},
toJSON: function ()
{
var output = {};
for (var key in propertyMap)
{
output[key] = this[key];
}
return output;
},
destroy: function ()
{
this.parent = undefined;

View file

@ -273,11 +273,11 @@ var Text = new Class({
var out = Components.ToJSON(this);
// Extra Text data is added here
// TODO: TextStyle.toJSON
var data = {
autoRound: this.autoRound,
text: this.text,
style: this.style.toJSON(),
resolution: this.resolution,
padding: {
x: this.padding.x,