fix: todo in useHandle

* edge update end only emits the mouse event, not the edge

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-16 13:04:55 +01:00
parent 7c66cf5d9b
commit 490983bebe
3 changed files with 3 additions and 7 deletions

View File

@@ -26,10 +26,9 @@ const nodeExtent: NodeExtent = [
]
const elements = ref<Elements>(initialElements)
const onConnect = (params: Connection | Edge) => (elements.value = addEdge({ ...params, animated: true }, elements.value))
const onConnect = (params: Connection) => (elements.value = addEdge({ ...params, animated: true }, elements.value))
const onElementsRemove = (elementsToRemove: Elements) => (elements.value = removeElements(elementsToRemove, elements.value))
// todo changing elements not properly updating flowchart...
const onLayout = (direction: string) => {
const isHorizontal = direction === 'LR'
dagreGraph.setGraph({ rankdir: direction })

View File

@@ -156,10 +156,7 @@ export default () => {
hooks.connectEnd.trigger(event)
if (elementEdgeUpdaterType) {
// todo fix missing edge
hooks.edgeUpdateEnd.trigger({ event } as any)
}
if (elementEdgeUpdaterType) hooks.edgeUpdateEnd.trigger(event)
resetRecentHandle(recentHoveredHandle)
store.setConnectionNodeId({ connectionNodeId: undefined, connectionHandleId: undefined, connectionHandleType: undefined })

View File

@@ -45,7 +45,7 @@ export interface FlowEvents {
edgeDoubleClick: { event: MouseEvent; edge: Edge }
edgeClick: { event: MouseEvent; edge: Edge }
edgeUpdateStart: { event: MouseEvent; edge: Edge }
edgeUpdateEnd: { event: MouseEvent; edge: Edge }
edgeUpdateEnd: MouseEvent
}
export type FlowHooks = { [key in keyof FlowEvents]: FlowHook<FlowEvents[key]> }