Odstrani mrtve websocket povezave, popravki inputa

main
Jurij Podgoršek 2022-05-05 19:13:49 +02:00
parent 1509776296
commit efe7e680c5
2 changed files with 13 additions and 11 deletions

15
anim.js
View File

@ -108,12 +108,6 @@ function render () {
camRotate();
};
window.onkeydown = function (e) {
crotacijaX *= 0.7;
crotacijaY *= 0.7;
crotacijaZ *= 0.7;
}
function modulirajParametre() {
// Vsi gumbi? => RESET
if ((keysPressed[0] + keysPressed[1] + keysPressed[2] + keysPressed[3]) === 4 && !reset) {
@ -156,6 +150,12 @@ function modulirajParametre() {
barva_mod += (dqZ / 1000);
obj_limit *= 1 - dqY;
}
if (kbdPressed['c']) {
crotacijaX *= 0.9;
crotacijaY *= 0.9;
crotacijaZ *= 0.9;
}
}
// Funkcija za animacijo objektov
@ -247,7 +247,8 @@ const kbdPressed = {
a: false,
s: false,
d: false,
f: false
f: false,
c: false
};
window.addEventListener('keydown', (e) => {

View File

@ -280,7 +280,7 @@ const sendAll = (msg, info, oscWS, osclients) => {
}
}
const osclients = []
let osclients = []
wss.on('connection', function (ws) {
console.log('new client connection')
@ -299,14 +299,15 @@ wss.on('connection', function (ws) {
oscWS.on('error', error => {
console.warn('Ignoring invalid OSC')
console.warn(error)
oscWS.close()
osclients = osclients.filter(ws => ws !== oscWS)
})
osclients.push(oscWS)
/*
oscWS.on('close', () => {
oscWS = null
console.log('closing socket', oscWS)
osclients = osclients.filter(ws => ws !== oscWS)
})
*/
})
// Zapri midi