r3-legacy/src/r3-api-scalar.js

60 lines
945 B
JavaScript

/**
* R3.API.Scalar
* @param apiComponent
*
* @property x
* @property y
*
* @constructor
*/
R3.API.Scalar = function(
apiComponent
) {
__DEREGISTER_COMPONENT__;
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.value)) {
apiComponent.value = 0;
}
this.value = apiComponent.value;
};
R3.API.Scalar.prototype = Object.create(R3.API.Component.prototype);
R3.API.Scalar.prototype.constructor = R3.API.Scalar;
/**
* Equals
* @param scalar
* @returns {boolean}
*/
R3.API.Scalar.prototype.equals = function(scalar) {
if (this.value === scalar.value) {
return true;
} else {
return false;
}
};
/**
* Add
* @param v
*/
R3.API.Scalar.prototype.add = function(scalar) {
this.value += scalar.value;
return this;
};
/**
* Subtract
* @param v
*/
R3.API.Scalar.prototype.subtract = function(scalar) {
this.value -= scalar.value;
return this;
};