Files
P42_UI/app/controllers/live/DashboardsController.js
T
2025-10-08 12:51:01 +00:00

90 lines
3.2 KiB
JavaScript

class DashboardsController extends EICController {
constructor(params) {
super(params)
this.arenaConfig = app.Assets.Store.json.arenaConfig
this.agentDefs = app.Assets.Store.json.agentDefs
this.eventsMapping = app.Assets.Store.json.eventsMapping
}
/**
*
* @returns
*/
spaceViewer() {
const models = {
}
const ttb = new app.LoadedModules.Threetobus({
eventsMapping: this.eventsMapping,
sceneSize: this.arenaConfig.arenaSize,
})
ttb.initScene({
axes: true,
grid: true,
})
const m1 = ttb.agentFromJSON('agent42', this.agentDefs.molecule1)
ttb.scene.add(m1)
//TODO: eventsMapping: address child by suffix in assignations
let left = app.User.preferences?.windows?.live?.spaceview?.['3D']?.x ? app.User.preferences.windows.live.spaceview['3D'].x :100
let top = app.User.preferences?.windows?.live?.spaceview?.['3D']?.y ? app.User.preferences.windows.live.spaceview['3D'].y :50
let width = app.User.preferences?.windows?.live?.spaceview?.['3D']?.w ? app.User.preferences.windows.live.spaceview['3D'].w :600
let height = app.User.preferences?.windows?.live?.spaceview?.['3D']?.h ? app.User.preferences.windows.live.spaceview['3D'].h :450
this.loadWindow(
'visualisers/SpaceView',
{
title: '3D view',
static: true,
expanded: false,
withSettings: true,
windowStyle:{
width: `${width}px`,
height: `${height}px`,
left: `${left}px`,
top: `${top}px`,
}
},
{
models: models,
agentDefs: this.agentDefs,
rendererId:'3drenderer',
mode: '3D',
ttb: ttb,
}
)
left = app.User.preferences?.windows?.live?.spaceview?.['2D']?.x ? app.User.preferences.windows.live.spaceview['2D'].x :500
top = app.User.preferences?.windows?.live?.spaceview?.['2D']?.y ? app.User.preferences.windows.live.spaceview['2D'].y :100
width = app.User.preferences?.windows?.live?.spaceview?.['2D']?.w ? app.User.preferences.windows.live.spaceview['2D'].w :600
height = app.User.preferences?.windows?.live?.spaceview?.['2D']?.h ? app.User.preferences.windows.live.spaceview['2D'].h :450
this.loadWindow(
'visualisers/SpaceView',
{
title: '2D View',
static: true,
expanded: false,
withSettings: true,
windowStyle:{
width: `${width}px`,
height: `${height}px`,
left: `${left}px`,
top: `${top}px`,
}
},
{
models: models,
agentDefs: this.agentDefs,
rendererId:'2drenderer',
mode: '2D',
ttb: ttb,
}
)
}
}
app.registerClass('DashboardsController', DashboardsController);