Files
P42_UI/app/views/dashboards/MainDashboardView.js
T
2025-09-19 16:09:03 +00:00

55 lines
1.5 KiB
JavaScript

class MainDashboardView extends EICDomContent {
constructor() {
super()
Object.assign(this, app.helpers.activeAttributes)
//this.tileMarkup = app.Assets.Store.html['/app/assets/html/mailing/tile.html']
this.snap = null
}
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.snap = Snap("svg.stb");
var agent = this.snap.circle(150, 150, 20);
agent.attr({
id: 'agent42',
fill: "#BFB",
stroke: "#0A0",
strokeWidth: 2
});
setTimeout(this.moveit.bind(this), 3000);
}
DOMContentFocused(options) {
// Avoid 2nd refesh on DomContentLoaded
if(this.wasBlured){
//this.refreshSearch()
}
this.wasBlured = false
}
DOMContentBlured(options) { this.wasBlured = true }
moveit(){
var myCircle = this.snap.select('#agent42')
var newx = parseInt(myCircle.attr('cx')) + 600
var newy = parseInt(myCircle.attr('cy')) + 200
// animate translate
myCircle.animate(
{
cx: newx,
cy: newy,
},
1000, // duration in ms
mina.linear // easing
)
}
}
app.registerClass('MainDashboardView', MainDashboardView)