agent def + windows fixes + 2d view + 3d view
This commit is contained in:
@@ -1,23 +1,33 @@
|
||||
class MainDashboardView extends EICDomContent {
|
||||
|
||||
|
||||
//TODO should come from the API, from some sprites lib. (allow switching representations)
|
||||
agentTypes = {
|
||||
molecule1:{
|
||||
type: 'circle',
|
||||
attrs: {
|
||||
r: 10,
|
||||
fill: '#BFB',
|
||||
stroke: "#0A0",
|
||||
strokeWidth: 2,
|
||||
}
|
||||
"type": "Mesh",
|
||||
"geometry": { "type": "BoxGeometry", "args": [1, 1, 1] },
|
||||
"material": { "type": "MeshStandardMaterial", "color": "orange" },
|
||||
"children": [
|
||||
{
|
||||
"type": "Mesh",
|
||||
"geometry": { "type": "SphereGeometry", "args": [0.3, 16, 16] },
|
||||
"material": { "type": "MeshStandardMaterial", "color": "blue" },
|
||||
"position": [0, 0.5, 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
molecule2:{
|
||||
type: 'circle',
|
||||
attrs: {
|
||||
r: 10,
|
||||
fill: '#BBF',
|
||||
stroke: "#00A",
|
||||
strokeWidth: 2,
|
||||
}
|
||||
"type": "Mesh",
|
||||
"geometry": { "type": "SphereGeometry", "args": [1, 1, 1] },
|
||||
"material": { "type": "MeshStandardMaterial", "color": "green" },
|
||||
"children": [
|
||||
{
|
||||
"type": "Mesh",
|
||||
"geometry": { "type": "SphereGeometry", "args": [0.3, 16, 16] },
|
||||
"material": { "type": "MeshStandardMaterial", "color": "red" },
|
||||
"position": [0, 1, 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,41 +35,36 @@ class MainDashboardView extends EICDomContent {
|
||||
constructor() {
|
||||
super()
|
||||
Object.assign(this, app.helpers.activeAttributes)
|
||||
//this.tileMarkup = app.Assets.Store.html['/app/assets/html/mailing/tile.html']
|
||||
}
|
||||
|
||||
DOMContentLoaded(options) {
|
||||
for(let model in options.models) this[model] = options.models[model]
|
||||
const components = ui.eicfy(this.el)
|
||||
this.setupTriggers(components)
|
||||
this.setupRefs(components)
|
||||
|
||||
this.ttb = new app.LoadedModules.Threetobus(this.outputs.paper43)
|
||||
this.ttb.init()
|
||||
|
||||
}
|
||||
|
||||
DOMContentFocused(options) {
|
||||
// Avoid 2nd refesh on DomContentLoaded
|
||||
if(this.wasBlured){
|
||||
//this.refreshSearch()
|
||||
//this.refreshyoustuff()
|
||||
}
|
||||
this.wasBlured = false
|
||||
}
|
||||
|
||||
DOMContentBlured(options) { this.wasBlured = true }
|
||||
|
||||
createAgent(agentType, id, x, y){
|
||||
if(!Object.keys(this.agentTypes).includes(agentType)) return
|
||||
this.agentTypes[agentType]
|
||||
const svgAgent = this.snaptobus.snap[this.agentTypes[agentType].type]().attr(this.agentTypes[agentType].attrs)
|
||||
svgAgent.attr({
|
||||
id: id,
|
||||
cx: x,
|
||||
cy:y,
|
||||
})
|
||||
DOMContentLoaded(options) {
|
||||
for(let model in options.models) this[model] = options.models[model]
|
||||
const components = ui.eicfy(this.el)
|
||||
this.setupTriggers(components)
|
||||
this.setupRefs(components)
|
||||
|
||||
this.ttb = new app.LoadedModules.Threetobus(this.outputs.paper43)
|
||||
this.ttb.initScene()
|
||||
this.ttb.changeCamera(options.camName)
|
||||
this.ttb.startRendering()
|
||||
|
||||
const m1 = this.ttb.buildFromJSON(this.agentTypes.molecule1)
|
||||
m1.name = 'toto'
|
||||
this.ttb.scene.add(m1)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
app.registerClass('MainDashboardView', MainDashboardView)
|
||||
|
||||
Reference in New Issue
Block a user