diff --git a/src/style_manager/model/Property.js b/src/style_manager/model/Property.js index ae8edb6e5..2ea2799df 100644 --- a/src/style_manager/model/Property.js +++ b/src/style_manager/model/Property.js @@ -67,4 +67,22 @@ module.exports = Backbone.Model.extend({ return result; }, + /** + * Get a complete value of the property. + * This probably will replace the getValue when all + * properties models will be splitted + * @param {string} val Custom value to replace the one on the model + * @return {string} + */ + getFullValue(val) { + const fn = this.get('functionName'); + let value = val || this.get('value'); + + if (fn) { + value = `${fn}(${value})`; + } + + return value; + }, + }); diff --git a/src/style_manager/model/PropertyInteger.js b/src/style_manager/model/PropertyInteger.js new file mode 100644 index 000000000..6ffc4baa7 --- /dev/null +++ b/src/style_manager/model/PropertyInteger.js @@ -0,0 +1,18 @@ +const Property = require('./Component'); + +module.exports = Property.extend({ + + defaults: Object.assign({}, Property.prototype.defaults, { + // Array of units, eg. ['px', '%'] + units: [], + + // Selected unit, eg. 'px' + unit: '', + }), + + getFullValue() { + let value = this.get('value') + this.get('unit'); + return Property.prototype.getFullValue.apply(this, [value]); + }, + +});