chore(selection): handle selectionOnDrag in click capture

This commit is contained in:
moklick
2025-10-16 15:50:48 +02:00
parent 353a497e71
commit ac423f3880
2 changed files with 14 additions and 2 deletions

View File

@@ -116,7 +116,8 @@ export function Pane({
const onWheel = onPaneScroll ? (event: React.WheelEvent) => onPaneScroll(event) : undefined;
const onClickCapture = (event: ReactMouseEvent) => {
const isSelectionOnDragActive = (selectionOnDrag && container.current === event.target) || !selectionOnDrag;
const isSelectionOnDragActive =
(selectionOnDrag && container.current === event.target) || !selectionOnDrag || selectionKeyPressed;
if (!isSelectionOnDragActive) {
return;

View File

@@ -230,7 +230,18 @@
onpanecontextmenu?.({ event });
};
const onClickCapture = (event: MouseEvent) => event.stopPropagation();
const onClickCapture = (event: MouseEvent) => {
const isSelectionActive =
(selectionOnDrag && container === event.target) ||
!selectionOnDrag ||
store.selectionKeyPressed;
if (!isSelectionActive) {
return;
}
event.stopPropagation();
};
</script>
<!-- svelte-ignore a11y_no_static_element_interactions -->