Browse Source

Use e.pressure from touch screen

sdf
A.Olokhtonov 2 months ago
parent
commit
967c7554dd
  1. 4
      client/webgl_listeners.js

4
client/webgl_listeners.js

@ -663,7 +663,7 @@ function touchstart(e, state, context) {
}); });
state.touch.drawing = true; state.touch.drawing = true;
const canvasp = screen_to_canvas(state, screenp); 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_start_prestroke(state, state.me);
geometry_add_prepoint(state, context, state.me, canvasp, e.pointerType === "pen"); geometry_add_prepoint(state, context, state.me, canvasp, e.pointerType === "pen");
state.touch.waiting_for_second_finger = true; 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 screenp = {'x': window.devicePixelRatio * e.clientX, 'y': window.devicePixelRatio * e.clientY};
const canvasp = screen_to_canvas(state, screenp); 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); geometry_add_prepoint(state, context, state.me, canvasp, false);
fire_event(state, predraw_event(canvasp.x, canvasp.y)); fire_event(state, predraw_event(canvasp.x, canvasp.y));

Loading…
Cancel
Save