From 967c7554ddd2ba942603f2229e7ee9d842fee346 Mon Sep 17 00:00:00 2001 From: "A.Olokhtonov" Date: Sun, 8 Dec 2024 16:29:00 +0300 Subject: [PATCH] Use e.pressure from touch screen --- client/webgl_listeners.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/webgl_listeners.js b/client/webgl_listeners.js index f92df3c..d66d027 100644 --- a/client/webgl_listeners.js +++ b/client/webgl_listeners.js @@ -663,7 +663,7 @@ function touchstart(e, state, context) { }); state.touch.drawing = true; const canvasp = screen_to_canvas(state, screenp); - canvasp.pressure = 128; // TODO: check out touch devices' e.pressure + canvasp.pressure = Math.ceil(e.pressure * 255); geometry_start_prestroke(state, state.me); geometry_add_prepoint(state, context, state.me, canvasp, e.pointerType === "pen"); state.touch.waiting_for_second_finger = true; @@ -696,7 +696,7 @@ function touchmove(e, state, context) { const screenp = {'x': window.devicePixelRatio * e.clientX, 'y': window.devicePixelRatio * e.clientY}; const canvasp = screen_to_canvas(state, screenp); - canvasp.pressure = 128; // TODO: check out touch devices' e.pressure + canvasp.pressure = Math.ceil(e.pressure * 255); geometry_add_prepoint(state, context, state.me, canvasp, false); fire_event(state, predraw_event(canvasp.x, canvasp.y));