diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 864cae1aaa..44d03cadda 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -44,7 +44,7 @@ declare module 'jsplumb' { }; // bind(event: string, (connection: Connection): void;): void; // tslint:disable-line:no-any - bind(event: string, callback: Function): void; // tslint:disable-line:no-any + bind(event: string, callback: Function): void; removeOverlay(name: string): void; removeOverlays(): void; setParameter(name: string, value: any): void; // tslint:disable-line:no-any diff --git a/packages/editor-ui/src/components/mixins/nodeBase.ts b/packages/editor-ui/src/components/mixins/nodeBase.ts index a15651e459..6e74324742 100644 --- a/packages/editor-ui/src/components/mixins/nodeBase.ts +++ b/packages/editor-ui/src/components/mixins/nodeBase.ts @@ -201,7 +201,7 @@ export const nodeBase = mixins( ['Label', { id: CanvasHelpers.OVERLAY_INPUT_NAME_LABEL, - location: [-3, 0.5], + location: CanvasHelpers.OVERLAY_INPUT_NAME_LABEL_POSITION, label: nodeTypeData.inputNames[index], cssClass: 'node-input-endpoint-label', visible: true, @@ -263,7 +263,7 @@ export const nodeBase = mixins( newEndpointData.overlays = [ ['Label', { - id: 'output-name-label', + id: CanvasHelpers.OVERLAY_OUTPUT_NAME_LABEL, location: [1.9, 0.5], label: nodeTypeData.outputNames[index], cssClass: 'node-output-endpoint-label', diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 7b9cd93551..53bedd9d24 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -1504,7 +1504,7 @@ export default mixins( const inputNameOverlay = info.targetEndpoint.getOverlay(CanvasHelpers.OVERLAY_INPUT_NAME_LABEL); if (inputNameOverlay) { - inputNameOverlay.setLocation([-4.5, .5]); + inputNameOverlay.setLocation(CanvasHelpers.OVERLAY_INPUT_NAME_LABEL_POSITION_MOVED); } this.$store.commit('addConnection', { @@ -1528,7 +1528,7 @@ export default mixins( // If the source endpoint is not connected to anything else anymore // display the output-name overlays on the endpoint if any exist if (sourceEndpoint !== undefined && sourceEndpoint.connections!.length === maxConnections) { - const outputNameOverlay = sourceEndpoint.getOverlay('output-name-label'); + const outputNameOverlay = sourceEndpoint.getOverlay(CanvasHelpers.OVERLAY_OUTPUT_NAME_LABEL); if (![null, undefined].includes(outputNameOverlay)) { outputNameOverlay.setVisible(true); } @@ -1576,8 +1576,7 @@ export default mixins( this.instance.bind('connectionDetached', (info) => { const inputNameOverlay = info.targetEndpoint.getOverlay(CanvasHelpers.OVERLAY_INPUT_NAME_LABEL); if (inputNameOverlay) { - // todo - inputNameOverlay.setLocation([-3, .5]); + inputNameOverlay.setLocation(CanvasHelpers.OVERLAY_INPUT_NAME_LABEL_POSITION); } updateConnectionDetach(info.sourceEndpoint, info.targetEndpoint, 1); diff --git a/packages/editor-ui/src/views/canvasHelpers.ts b/packages/editor-ui/src/views/canvasHelpers.ts index 760e9d5c62..eb319b25ef 100644 --- a/packages/editor-ui/src/views/canvasHelpers.ts +++ b/packages/editor-ui/src/views/canvasHelpers.ts @@ -10,6 +10,9 @@ export const OVERLAY_RUN_ITEMS_ID = 'output-items-label'; export const OVERLAY_CONNECTION_ACTIONS_ID = 'connection-actions'; export const JSPLUMB_FLOWCHART_STUB = 26; export const OVERLAY_INPUT_NAME_LABEL = 'input-name-label'; +export const OVERLAY_INPUT_NAME_LABEL_POSITION = [-3, .5]; +export const OVERLAY_INPUT_NAME_LABEL_POSITION_MOVED = [-4.5, .5]; +export const OVERLAY_OUTPUT_NAME_LABEL = 'output-name-label'; const MIN_X_TO_SHOW_OUTPUT_LABEL = 90; const MIN_Y_TO_SHOW_OUTPUT_LABEL = 100; @@ -57,7 +60,7 @@ export const getFlowChartType = (connection: Connection) => { const outputIndex = connection.__meta ? connection.__meta.sourceOutputIndex : 0; const outputEndpoint = connection.endpoints[0]; - const outputOverlay = outputEndpoint.getOverlay('output-name-label'); + const outputOverlay = outputEndpoint.getOverlay(OVERLAY_OUTPUT_NAME_LABEL); let labelOffset = 0; if (outputOverlay && outputOverlay.label && outputOverlay.label.length > 1) { labelOffset = 16;