fix(sensor-panel): stop mousedown so the slider drags instead of panning

The previous fix opened the SensorControlPanel on a desktop sensor
click during simulation, but the slider thumb still couldn't be
dragged — the canvas pan handler claims any left mousedown that isn't
explicitly stopped, so grabbing the slider was panning the canvas.

The panel only stopped click events. We now stop mousedown and
pointerdown on the panel wrapper as well, so input[type=range] gets
its native drag and the pan handler stays out.
This commit is contained in:
David Montero Crespo 2026-05-16 20:56:24 -03:00
parent 286b378d8e
commit f73697c59b
1 changed files with 9 additions and 1 deletions

View File

@ -150,7 +150,15 @@ export const SensorControlPanel: React.FC<SensorControlPanelProps> = ({
};
return (
<div className="sensor-control-panel" onClick={(e) => e.stopPropagation()}>
<div
className="sensor-control-panel"
onClick={(e) => e.stopPropagation()}
// The canvas treats left mousedown on empty space as a pan gesture.
// Without stopping mousedown here, dragging the lux/temp/etc. slider
// thumb pans the canvas instead of moving the slider.
onMouseDown={(e) => e.stopPropagation()}
onPointerDown={(e) => e.stopPropagation()}
>
<div className="sensor-panel-header">
<span className="sensor-panel-title">{sensorName || def.title}</span>
<button className="sensor-panel-close" onClick={onClose} title={t('editor.sensorPanel.close')}>