r3-legacy/bak/r3-d3-api-selected-object.js

47 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2017-01-12 17:40:17 +01:00
/**
* This component makes the parentEntity (ex. car) follow the path provided by the spline
* @param id String
* @param name String
* @param object
* @param helper
* @param lastUpdate
* @constructor
*/
2018-04-09 10:05:13 +02:00
R3.D3.API.SelectedObject = function (
2017-01-12 17:40:17 +01:00
object,
helper,
lastUpdate
) {
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(object)) {
2017-01-12 17:40:17 +01:00
console.warn('Cannot select no object');
throw new Error('Cannot select no object');
}
this.object = object;
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(helper)) {
2017-01-12 17:40:17 +01:00
helper = null;
}
this.helper = helper;
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(lastUpdate)) {
2017-01-12 17:40:17 +01:00
lastUpdate = Date.now();
}
this.lastUpdate = lastUpdate;
};
/**
2018-04-09 10:05:13 +02:00
* Object to R3.D3.API.SelectedObject
2017-01-12 17:40:17 +01:00
* @param objectComponent
2018-04-09 10:05:13 +02:00
* @returns {R3.D3.API.SelectedObject}
2017-01-12 17:40:17 +01:00
* @constructor
*/
2018-04-09 10:05:13 +02:00
R3.D3.API.SelectedObject.FromObjectSelectedObject = function(objectComponent) {
return new R3.D3.API.SelectedObject(
2017-01-12 17:40:17 +01:00
objectComponent.id,
objectComponent.name,
objectComponent.object,
objectComponent.helper,
objectComponent.lastUpdate
);
};