From 26ec2216ce45a6950dcdf6f6250a7e0046341a9b Mon Sep 17 00:00:00 2001 From: Aleksey Olokhtonov Date: Mon, 5 Jan 2026 14:55:38 +0300 Subject: [PATCH] Unstuck from picker mode on mousemove with no ctrl. --- README.txt | 6 ++++-- client/config.js | 2 +- client/webgl_listeners.js | 18 ++++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.txt b/README.txt index 6c50cce..7e5ad0c 100644 --- a/README.txt +++ b/README.txt @@ -109,6 +109,8 @@ Shiplist: - offline-only version - select and manupulate curves with selection tool - deduplicate pictures - - Color picker should work for ruler - - Show previous color in color picker preview - No lag while downloading images + - Show previous color in color picker preview + - Color picker should work for ruler + - Color picker precision and pick order seems off + + Stuck in color picker mode when mouse leaves screen diff --git a/client/config.js b/client/config.js index 13038f3..3724741 100644 --- a/client/config.js +++ b/client/config.js @@ -6,7 +6,7 @@ const config = { ws_reconnect_timeout: 2000, brush_preview_timeout: 1000, second_finger_timeout: 500, - debug_print: true, + debug_print: false, draw_bvh: false, draw_fullnodes: false, zoom_delta: 0.05, diff --git a/client/webgl_listeners.js b/client/webgl_listeners.js index edb0bba..8494b72 100644 --- a/client/webgl_listeners.js +++ b/client/webgl_listeners.js @@ -6,8 +6,7 @@ function init_listeners(state, context) { context.canvas.addEventListener('pointerdown', (e) => pointerdown(e, state, context)); context.canvas.addEventListener('pointermove', (e) => pointermove(e, state, context)); context.canvas.addEventListener('pointerup', (e) => pointerup(e, state, context)); - context.canvas.addEventListener('pointercancel', (e) => pointerup(e, state, context)); - //context.canvas.addEventListener('pointerleave', (e) => pointerup(e, state, context)); + context.canvas.addEventListener('pointercancel', (e) => pointercancel(e, state, context)); context.canvas.addEventListener('pointerleave', (e) => pointerleave(e, state, context)); context.canvas.addEventListener('contextmenu', cancel); context.canvas.addEventListener('wheel', (e) => wheel(e, state, context)); @@ -170,7 +169,7 @@ function keydown(e, state, context) { function keyup(e, state, context) { if (config.debug_print) { - console.debug('keydown', e.code); + console.debug('keyup', e.code); } if (e.code === 'Space' && state.spacedown) { @@ -361,7 +360,11 @@ function pointermove(e, state, context) { } if (state.colorpicking) { - update_color_picker_color(state, context, canvasp); + if (!e.ctrlKey) { + exit_picker_mode(state); + } else { + update_color_picker_color(state, context, canvasp); + } } if (state.zooming) { @@ -590,8 +593,11 @@ function pointerleave(e, state, context) { context.canvas.classList.remove('movemode'); } - //exit_picker_mode(state); - // something else? + // exit_picker_mode(state); +} + +function pointercancel(e, state, context) { + console.log('CANCEL'); } function update_cursor(state) {