chore(selection): handle selectionOnDrag in click capture
This commit is contained in:
@@ -116,7 +116,8 @@ export function Pane({
|
|||||||
const onWheel = onPaneScroll ? (event: React.WheelEvent) => onPaneScroll(event) : undefined;
|
const onWheel = onPaneScroll ? (event: React.WheelEvent) => onPaneScroll(event) : undefined;
|
||||||
|
|
||||||
const onClickCapture = (event: ReactMouseEvent) => {
|
const onClickCapture = (event: ReactMouseEvent) => {
|
||||||
const isSelectionOnDragActive = (selectionOnDrag && container.current === event.target) || !selectionOnDrag;
|
const isSelectionOnDragActive =
|
||||||
|
(selectionOnDrag && container.current === event.target) || !selectionOnDrag || selectionKeyPressed;
|
||||||
|
|
||||||
if (!isSelectionOnDragActive) {
|
if (!isSelectionOnDragActive) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -230,7 +230,18 @@
|
|||||||
onpanecontextmenu?.({ event });
|
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>
|
</script>
|
||||||
|
|
||||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
|
|||||||
Reference in New Issue
Block a user