From 490983bebe1dfc7d55e7c8ed0d9f7f4008d74371 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 16 Nov 2021 13:04:55 +0100 Subject: [PATCH] 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> --- examples/Layouting/LayoutingExample.vue | 3 +-- src/composables/useHandle.ts | 5 +---- src/types/hooks.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/Layouting/LayoutingExample.vue b/examples/Layouting/LayoutingExample.vue index 0502319c..8c48cc4d 100644 --- a/examples/Layouting/LayoutingExample.vue +++ b/examples/Layouting/LayoutingExample.vue @@ -26,10 +26,9 @@ const nodeExtent: NodeExtent = [ ] const elements = ref(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 }) diff --git a/src/composables/useHandle.ts b/src/composables/useHandle.ts index 8ec9de52..7f6e41c2 100644 --- a/src/composables/useHandle.ts +++ b/src/composables/useHandle.ts @@ -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 }) diff --git a/src/types/hooks.ts b/src/types/hooks.ts index 7657fcbb..bcd74d62 100644 --- a/src/types/hooks.ts +++ b/src/types/hooks.ts @@ -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 }