selectable correctly influences cursor types for nodes & edges
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
export let animated: $$Props['animated'] = false;
|
||||
export let selected: $$Props['selected'] = false;
|
||||
export let selectable: $$Props['selectable'] = undefined;
|
||||
export let hidden: $$Props['hidden'] = false;
|
||||
export let label: $$Props['label'] = undefined;
|
||||
export let labelStyle: $$Props['labelStyle'] = undefined;
|
||||
@@ -44,7 +45,7 @@
|
||||
|
||||
setContext('svelteflow__edge_id', id);
|
||||
|
||||
const { edgeLookup, edgeTypes, flowId } = useStore();
|
||||
const { edgeLookup, edgeTypes, flowId, elementsSelectable } = useStore();
|
||||
const dispatch = createEventDispatcher<{
|
||||
edgeclick: { edge: Edge; event: MouseEvent | TouchEvent };
|
||||
edgecontextmenu: { edge: Edge; event: MouseEvent };
|
||||
@@ -53,6 +54,7 @@
|
||||
$: edgeComponent = $edgeTypes[type!] || BezierEdgeInternal;
|
||||
$: markerStartUrl = markerStart ? `url(#${getMarkerId(markerStart, $flowId)})` : undefined;
|
||||
$: markerEndUrl = markerEnd ? `url(#${getMarkerId(markerEnd, $flowId)})` : undefined;
|
||||
$: isSelectable = selectable || ($elementsSelectable && typeof selectable === 'undefined');
|
||||
|
||||
const handleEdgeSelect = useHandleEdgeSelect();
|
||||
|
||||
@@ -82,6 +84,7 @@
|
||||
class={cc(['svelte-flow__edge', className])}
|
||||
class:animated
|
||||
class:selected
|
||||
class:selectable={isSelectable}
|
||||
data-id={id}
|
||||
on:click={onClick}
|
||||
on:contextmenu={onContextMenu}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
style={edge.style}
|
||||
animated={edge.animated}
|
||||
selected={edge.selected}
|
||||
selectable={edge.selectable}
|
||||
hidden={edge.hidden}
|
||||
label={edge.label}
|
||||
labelStyle={edge.labelStyle}
|
||||
|
||||
@@ -123,7 +123,10 @@
|
||||
|
||||
.xy-flow__edge {
|
||||
pointer-events: visibleStroke;
|
||||
cursor: pointer;
|
||||
|
||||
&.selectable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.animated path {
|
||||
stroke-dasharray: 5;
|
||||
@@ -188,6 +191,10 @@ svg.xy-flow__connectionline {
|
||||
box-sizing: border-box;
|
||||
cursor: default;
|
||||
|
||||
&.selectable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.draggable {
|
||||
cursor: grab;
|
||||
pointer-events: all;
|
||||
|
||||
Reference in New Issue
Block a user