From 2a790a51a954e708d062c99d195be6d0c9261d4a Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Tue, 4 Jun 2019 18:46:38 +0000 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=94=91=20=20added=20mobile=20events=20?= =?UTF-8?q?in=20main=20=F0=9F=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ts/main.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/ts/main.ts b/src/ts/main.ts index 491eca0..fc18acd 100644 --- a/src/ts/main.ts +++ b/src/ts/main.ts @@ -14,7 +14,7 @@ manager.save() manager.update() window.onerror = (message: string, url: string, lineNumber: number): boolean => { - error(message,"",{ + error(message, "", { ...manager.alertOptions, onclick: () => modal({ no: "", @@ -51,18 +51,27 @@ const handleEvent = (e: T, func: (e: T) => any) => { manager.barAlpha.next("0") } -render(html` -
handleEvent(e, (e: MouseEvent) => { +const moveHandler = (e: MouseEvent) => handleEvent(e, (e: MouseEvent) => { manager.handleMouseMove(e) screen.updateMouse(e) -})} +}) + +render(html` +
handleEvent(e, () => manager.handleMouseDown() )} - @mouseup=${(e: MouseEvent) => handleEvent(e, () => + @touchdown=${(e: MouseEvent) => handleEvent(e, () => + manager.handleMouseDown() +)} + @mouseup=${(e: MouseEvent) => handleEvent(e, () => manager.handleMouseUp() )} - @wheel=${(e: MouseEvent) => handleEvent(e, (e: WheelEvent) => + @touchup=${(e: MouseEvent) => handleEvent(e, () => + manager.handleMouseUp() +)} + @wheel=${(e: MouseEvent) => handleEvent(e, (e: WheelEvent) => screen.handleScroll(e) )}>