diff --git a/client/config.js b/client/config.js index 3724741..9732f52 100644 --- a/client/config.js +++ b/client/config.js @@ -6,6 +6,8 @@ const config = { ws_reconnect_timeout: 2000, brush_preview_timeout: 1000, second_finger_timeout: 500, + animation_decay: 16, + vertical_zoom_speed_multiplier: 3, debug_print: false, draw_bvh: false, draw_fullnodes: false, diff --git a/client/webgl_draw.js b/client/webgl_draw.js index 1b34d35..cf69519 100644 --- a/client/webgl_draw.js +++ b/client/webgl_draw.js @@ -641,7 +641,11 @@ function exp_decay(a, b, decay, dt) { } function update_canvas_zoom(state, current, target, dt) { - const decay = 16; + let decay = config.animation_decay; + + if (state.zoomdown) { + decay *= config.vertical_zoom_speed_multiplier; // to make it feel more responsive at fast speed + } if (Math.abs(1.0 - current / target) > 0.01) { state.canvas.zoom = exp_decay(state.canvas.zoom, target, decay, dt / 1000.0); diff --git a/client/webgl_listeners.js b/client/webgl_listeners.js index ccc5409..d678164 100644 --- a/client/webgl_listeners.js +++ b/client/webgl_listeners.js @@ -368,18 +368,8 @@ function pointermove(e, state, context) { } if (state.zooming) { - const zooming_in = e.movementY > 0; - const zooming_out = e.movementY < 0; - - let zoom_level = null; - - if (zooming_in) { - zoom_level = state.canvas.zoom_level + 1 - } else if (zooming_out) { - zoom_level = state.canvas.zoom_level - 1; - } else { - return; - } + const zoom_level_increment = Math.round(Math.sign(e.movementY) * Math.sqrt(Math.abs(e.movementY))); + let zoom_level = state.canvas.zoom_level + zoom_level_increment; if (zoom_level < config.min_zoom_level || zoom_level > config.max_zoom_level) { return;