enter on login + animate in snaptobus
This commit is contained in:
+17
-10
@@ -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
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user