diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index a54f447422..6cd8cc5658 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -1503,17 +1503,11 @@ export default mixins( const elements = document.querySelector('div.jtk-endpoint.dropHover'); if (elements && !droppable) { droppable = true; - connection.setConnector(CanvasHelpers.getFlowChartType(connection)); - connection.setPaintStyle(CanvasHelpers.CONNECTOR_PAINT_STYLE_PRIMARY); - CanvasHelpers.addOverlays(connection, CanvasHelpers.CONNECTOR_ARROW_OVERLAYS); - CanvasHelpers.hideOverlay(connection, CanvasHelpers.OVERLAY_DROP_NODE_ID); + CanvasHelpers.showDropConnectionState(connection); } else if (!elements && droppable) { droppable = false; - connection.setConnector(CanvasHelpers.CONNECTOR_TYPE_STRIGHT); - connection.setPaintStyle(CanvasHelpers.CONNECTOR_PAINT_STYLE_DEFAULT); - CanvasHelpers.addOverlays(connection, CanvasHelpers.CONNECTOR_ARROW_OVERLAYS); - CanvasHelpers.showOverlay(connection, CanvasHelpers.OVERLAY_DROP_NODE_ID); + CanvasHelpers.showPullConnectionState(connection); } }; diff --git a/packages/editor-ui/src/views/canvasHelpers.ts b/packages/editor-ui/src/views/canvasHelpers.ts index 4476cfa831..a89379baa3 100644 --- a/packages/editor-ui/src/views/canvasHelpers.ts +++ b/packages/editor-ui/src/views/canvasHelpers.ts @@ -520,3 +520,17 @@ export const getUniqueNodeName = (nodes: INodeUi[], originalName: string, additi return uniqueName; }; + +export const showDropConnectionState = (connection: Connection) => { + connection.setConnector(getFlowChartType(connection)); + connection.setPaintStyle(CONNECTOR_PAINT_STYLE_PRIMARY); + addOverlays(connection, CONNECTOR_ARROW_OVERLAYS); + hideOverlay(connection, OVERLAY_DROP_NODE_ID); +}; + +export const showPullConnectionState = (connection: Connection) => { + connection.setConnector(CONNECTOR_TYPE_STRIGHT); + connection.setPaintStyle(CONNECTOR_PAINT_STYLE_DEFAULT); + addOverlays(connection, CONNECTOR_ARROW_OVERLAYS); + showOverlay(connection, OVERLAY_DROP_NODE_ID); +};