r3-legacy/src/r3-controls-touch.js

82 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-04-09 09:35:04 +02:00
/**
* Touch Controls
* @constructor
* @param apiTouchControls
*/
R3.Controls.Touch = function (
apiTouchControls
) {
if (R3.Utils.UndefinedOrNull(apiTouchControls)) {
apiTouchControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_TOUCH
};
}
R3.API.Controls.Touch.call(
this,
apiTouchControls,
apiTouchControls.sensitivity
);
R3.Controls.call(
this,
apiTouchControls
);
};
/**
* Inheritance
* @type {R3.Controls}
*/
R3.Controls.Touch.prototype = Object.create(R3.Controls.prototype);
R3.Controls.Touch.prototype.constructor = R3.Controls.Touch;
/**
* Create Instance
* @returns
*/
R3.Controls.Touch.prototype.createInstance = function() {
/**
* Set instance to true to indicate no dependencies to other components
*/
this.instance = true;
R3.Controls.prototype.createInstance.call(this);
};
/**
* Update Instance
*/
R3.Controls.Touch.prototype.updateInstance = function(property) {
R3.Controls.prototype.updateInstance.call(this, property);
};
/**
* Converts a R3.Controls.Touch to a R3.API.Controls
* @returns {R3.API.Controls}
*/
R3.Controls.Touch.prototype.toApiObject = function() {
var apiControls = R3.Controls.prototype.toApiObject.call(this);
apiControls.sensitivity = this.sensitivity;
/**
* add other properties here as this component develops...
*/
return apiControls;
};
/**
* Construct an Touch Controls object from data
* @param objectControls
* @returns {R3.Controls.Touch}
* @constructor
*/
R3.Controls.Touch.FromObject = function(objectControls) {
var apiTouchControls = R3.API.Controls.Touch.FromObject(objectControls);
return new R3.Controls.Touch(apiTouchControls);
};