Browse Source

Fix HiDPI support on non-touch devices

infinite
A.Olokhtonov 2 years ago
parent
commit
bf273a9424
  1. 6
      client/webgl_listeners.js

6
client/webgl_listeners.js

@ -50,7 +50,7 @@ function mousedown(e, state, context) { @@ -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) { @@ -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) { @@ -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);

Loading…
Cancel
Save