enter on login + animate in snaptobus

This commit is contained in:
STEINNI
2025-09-22 19:49:33 +00:00
parent 1641f5b07e
commit 7c6047462f
4 changed files with 30 additions and 133 deletions
+17 -10
View File
@@ -93,16 +93,7 @@ class myUser extends app.LoadedClasses.User {
const startbtn = document.querySelector('#startbtn')
const gobtn = document.querySelector('#login-dialog button')
gobtn.addEventListener('click', async () => {
gobtn.disabled = true
if(await this.login()) {
document.querySelector('div.loginerr').classList.remove('show')
console.log('Successful login !!!')
callBack()
} else {
gobtn.disabled = false
}
})
gobtn.addEventListener('click', () => this.launchLogin(callBack))
startbtn.addEventListener('click', async () => {
startbtn.disabled = true
@@ -116,6 +107,9 @@ class myUser extends app.LoadedClasses.User {
} else if(!jsonresp.payload.authenticated){
document.querySelector('div.loginerr').classList.remove('show')
document.getElementById('login-dialog').classList.add('show')
document.getElementById('login-dialog').addEventListener('keyup',(event)=>{
if(event.key=='Enter') this.launchLogin(callBack)
})
if(jsonresp.payload.locked){
document.querySelector('div.loginerr').classList.add('show')
document.querySelector('div.loginerr').innerHTML = `
@@ -134,6 +128,19 @@ class myUser extends app.LoadedClasses.User {
})
}
async launchLogin(callBack){
const gobtn = document.querySelector('#login-dialog button')
gobtn.disabled = true
if(await this.login()) {
document.querySelector('div.loginerr').classList.remove('show')
console.log('Successful login !!!')
callBack()
} else {
gobtn.disabled = false
}
}
/**
*
* @returns {string}
+9 -2
View File
@@ -115,8 +115,15 @@ class Snaptobus{
console.log(`found ${snaps.length} snaps`)
snaps.forEach(snapEl => {
const newAttr = this.assignFromConfig(payload, snapDef.assign)
console.log('newAttr:',newAttr)
snapEl.attr(newAttr)
if(snapDef.animate){
snapEl.animate(
newAttr,
400,
mina.linear
)
} else {
snapEl.attr(newAttr)
}
})
}
}
+4 -4
View File
@@ -42,15 +42,15 @@ class MainDashboardView extends EICDomContent {
{
chan: 'gps:agents', // What to subscribe to
events: [ // What to select on this chan
{ eventName: 'moving',
{ eventName: 'moving', // which event will trigger a change
snaps: [
{
selector: '#${aid}',
assign: {
selector: '#${aid}', // what svg elements do we change ?
assign: { // what do we change and with what from the payload ?
cx: 'attrs.x',
cy: 'attrs.y',
},
animate: true
animate: true
}
]
},