🔑 added mobile events in main 🚏

This commit is contained in:
Matei Adriel 2019-06-04 18:46:38 +00:00
parent b2a8e3bf96
commit 2a790a51a9

View file

@ -51,16 +51,25 @@ const handleEvent = <T>(e: T, func: (e: T) => any) => {
manager.barAlpha.next("0")
}
render(html`
<div @mousemove=${(e: MouseEvent) => handleEvent(e, (e: MouseEvent) => {
const moveHandler = (e: MouseEvent) => handleEvent(e, (e: MouseEvent) => {
manager.handleMouseMove(e)
screen.updateMouse(e)
})}
})
render(html`
<div @mousemove=${moveHandler}
@touchmove=${moveHandler}
@mousedown=${(e: MouseEvent) => handleEvent(e, () =>
manager.handleMouseDown()
)}
@touchdown=${(e: MouseEvent) => handleEvent(e, () =>
manager.handleMouseDown()
)}
@mouseup=${(e: MouseEvent) => handleEvent(e, () =>
manager.handleMouseUp()
)}
@touchup=${(e: MouseEvent) => handleEvent(e, () =>
manager.handleMouseUp()
)}
@wheel=${(e: MouseEvent) => handleEvent(e, (e: WheelEvent) =>
screen.handleScroll(e)