Commit 547fec29 authored by Michael Aschauer's avatar Michael Aschauer
Browse files

fix keyboard handler

parent 1c2838e6
......@@ -3,7 +3,6 @@
id="aspace"
class="absolute bottom-0 left-0 w-full h-full"
:style="{ background: darken(msgcolor(user)) }"
@keyup="onKey"
>
<div
v-if="running"
......@@ -358,14 +357,16 @@ export default {
})
window.addEventListener("resize", this.onResize)
window.addEventListener("keydown", this.onKey)
window.addEventListener("keydown", this.onKeyDown)
window.addEventListener("keyup", this.onKeyUp)
// window.addEventListener("mousedown", this.start)
},
destroyed () {
window.removeEventListener("resize", this.onResize)
window.removeEventListener("keydown", this.onKey)
window.removeEventListener("keydown", this.onKeyDown)
window.removeEventListener("keyup", this.onKeyUp)
// window.removeEventListener("mousedown", this.start)
window.cancelAnimationFrame(this.drawID);
},
......@@ -713,7 +714,7 @@ export default {
this.reArrangeAudience(this.user)
},
onKey (e) {
onKeyDown (e) {
let min_y = (0 - this.y_offset - this.height/2) / this.radius
let max_y = (this.height - this.y_offset - this.height/2) / this.radius
let min_x = (0 - this.x_offset - this.width/2) / this.radius
......@@ -736,6 +737,12 @@ export default {
}
},
onKeyUp(e) {
if (this.running) {
this.socket.emit('moved', this.user)
}
},
dragUser (e) {
if (this.dragging) {
this.user.x = (e.clientX - this.x_offset - this.width/2) / this.radius
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment