/** * Runtime vector2 for updating instance objects * @param apiNumber R3.API.Number * @param parentObject * @constructor */ R3.Number = function( apiNumber, parentObject ) { if (R3.Utils.UndefinedOrNull(apiNumber)) { apiNumber = {}; } R3.API.Number.call( this, apiNumber ); if (R3.Utils.UndefinedOrNull(parentObject)) { parentObject = null; } this.parentObject = parentObject; this.createInstance(); }; R3.Number.prototype = Object.create(R3.API.Number.prototype); R3.Number.prototype.constructor = R3.Number; /** * Creates an instance vector2 * @returns {*} */ R3.Number.prototype.createInstance = function() { this.instance = {}; }; /** * Updates the instance vector, calls updateInstance on the parent object */ R3.Number.prototype.updateInstance = function(property, parentProperty) { if (property === 'value') { if (this.parentObject && this.parentObject.updateInstance) { this.parentObject.updateInstance(parentProperty); } } if (property === 'grain') { console.warn('todo: update number instance grain'); } if (property === 'min') { console.warn('todo: update number instance min'); } if (property === 'max') { console.warn('todo: update number instance max'); } }; /** * Converts runtime vector to API Vector * @returns {R3.API.Number} */ R3.Number.prototype.toApiObject = function() { return new R3.API.Number( this.value, this.grain, this.min, this.max ); };