Files
P42_UI/app/controllers/dashboard/DashboardsController.js
T
2025-09-28 18:28:17 +00:00

98 lines
2.6 KiB
JavaScript

class DashboardsController extends EICController {
constructor(params) {
super(params)
this.agentDefs = app.Assets.Store.json.agentDefs
this.eventsMapping = app.Assets.Store.json.eventsMapping
}
/**
*
* @returns
*/
index() {
const models = {
}
const ttb = new app.LoadedModules.Threetobus({
eventsMapping: this.eventsMapping,
})
ttb.initScene({
axes: true,
grid: true,
})
const m1 = ttb.buildFromJSON('agent42', this.agentDefs.molecule1)
ttb.scene.add(m1)
// setTimeout(() => {
// ttb.smoothMove({
// object: m1,
// dX: 5,
// dY:0,
// dZ:0,
// delay: 1500,
// easing: 'Quadratic',
// easingMode: 'InOut',
// })
// },3000)
//TODO : side switches
// window.addEventListener('keydown', (e) => {
// if (e.key.toLowerCase() === 'g') {
// ttb.grid.visible = !grid.visible
// }
// if (e.key.toLowerCase() === 'a') {
// ttb.axes.visible = !axes.visible
// }
// })
//TODO: eventsMapping: address child by suffix in assignations
this.loadWindow(
'visualisers/SpaceView',
{
title: '3D view',
static: true,
expanded: false,
withSettings: true,
windowStyle:{
width: '800px',
height: '600px',
left: '50px',
top: '100px',
}
},
{
models: models,
agentDefs: this.agentDefs,
rendererId:'3drenderer',
mode: '3D',
ttb: ttb,
}
)
this.loadWindow(
'visualisers/SpaceView',
{
title: '2D View',
static: true,
expanded: false,
withSettings: true,
windowStyle:{
width: '600px',
height: '450px',
right:'10px',
top:'100px',
}
},
{
models: models,
agentDefs: this.agentDefs,
rendererId:'2drenderer',
mode: '2D',
ttb: ttb,
}
)
}
}
app.registerClass('DashboardsController', DashboardsController);