diff --git a/client/webgl_listeners.js b/client/webgl_listeners.js index cbfac86..7e78fbb 100644 --- a/client/webgl_listeners.js +++ b/client/webgl_listeners.js @@ -50,7 +50,7 @@ function mousedown(e, state, context) { return; } - const screenp = {'x': e.clientX, 'y': e.clientY}; + const screenp = {'x': window.devicePixelRatio * e.clientX, 'y': window.devicePixelRatio * e.clientY}; const canvasp = screen_to_canvas(state, screenp); clear_dynamic_stroke(state, context, state.me); @@ -71,7 +71,7 @@ function mousemove(e, state, context) { do_draw = true; } - const screenp = {'x': e.clientX, 'y': e.clientY}; + const screenp = {'x': window.devicePixelRatio * e.clientX, 'y': window.devicePixelRatio * e.clientY}; const canvasp = screen_to_canvas(state, screenp); state.cursor = screenp; @@ -121,7 +121,7 @@ function mouseup(e, state, context) { } function wheel(e, state, context) { - const screenp = {'x': e.clientX, 'y': e.clientY}; + const screenp = {'x': window.devicePixelRatio * e.clientX, 'y': window.devicePixelRatio * e.clientY}; const canvasp = screen_to_canvas(state, screenp); const dz = (e.deltaY < 0 ? 0.1 : -0.1);