diff --git a/UI/Input/DirectionInput.ts b/UI/Input/DirectionInput.ts index 3d7f89a408..d6399fd911 100644 --- a/UI/Input/DirectionInput.ts +++ b/UI/Input/DirectionInput.ts @@ -62,7 +62,9 @@ export default class DirectionInput extends InputElement { htmlElement.ontouchmove = (ev: TouchEvent) => { + console.log("Getting a touch", ev.touches[0].clientX, ev.touches[0].clientY) onPosChange(ev.touches[0].clientX, ev.touches[0].clientY); + ev.preventDefault(); } let isDown = false; diff --git a/test.ts b/test.ts index e578eb8f1f..87cb971bd6 100644 --- a/test.ts +++ b/test.ts @@ -5,9 +5,15 @@ import Direction from "./UI/Input/DirectionInput"; import {UIEventSource} from "./Logic/UIEventSource"; import {VariableUiElement} from "./UI/Base/VariableUIElement"; -const d = new UIEventSource(90); +const d = new UIEventSource("90"); new Direction(d).AttachTo("maindiv") -new VariableUiElement(d.map(d => ""+d+"°")).AttachTo("extradiv") +new VariableUiElement(d.map(d => "" + d + "°")).AttachTo("extradiv") + +UIEventSource.Chronic(25, () => { + const degr = (Number(d.data) + 1) % 360; + d.setData(""+ degr); + return true; +}) /*/