hide labels on connectors

This commit is contained in:
Mutasem 2021-10-18 18:17:13 +02:00
parent 3cca56d2ee
commit f7ad5c0da8
2 changed files with 21 additions and 1 deletions

View file

@ -133,7 +133,7 @@ import NodeCreator from '@/components/NodeCreator/NodeCreator.vue';
import NodeSettings from '@/components/NodeSettings.vue';
import RunData from '@/components/RunData.vue';
import { getLeftmostTopNode, getWorkflowCorners, scaleSmaller, scaleBigger, scaleReset, showOrHideMidpointArrow, addEndpointArrow, getDefaultOverlays, getIcon, getNewNodePosition, hideMidpointArrow } from './helpers';
import { getLeftmostTopNode, getWorkflowCorners, scaleSmaller, scaleBigger, scaleReset, showOrHideMidpointArrow, addEndpointArrow, getDefaultOverlays, getIcon, getNewNodePosition, hideMidpointArrow, showOrHideItemsLabel } from './helpers';
import mixins from 'vue-typed-mixins';
import { v4 as uuidv4} from 'uuid';
@ -1732,6 +1732,7 @@ export default mixins(
[...incoming, ...outgoing].forEach((connection: Connection) => {
showOrHideMidpointArrow(connection);
showOrHideItemsLabel(connection);
});
},
onNodeRun ({name, data}: {name: string, data: ITaskData[] | null}) {

View file

@ -162,6 +162,25 @@ export const getIcon = (name: string): string => {
return '';
};
export const showOrHideItemsLabel = (connection: Connection) => {
const overlay = connection.getOverlay('output-items-label');
if (!overlay) {
return;
}
// @ts-ignore
const bounds = connection.connector.bounds;
const diffX = Math.abs(bounds.maxX - bounds.minX);
const diffY = Math.abs(bounds.maxY - bounds.minY);
if (diffX < 150 && diffY < 100) {
overlay.setVisible(false);
}
else {
overlay.setVisible(true);
}
};
const canUsePosition = (position1: XYPositon, position2: XYPositon) => {
if (Math.abs(position1[0] - position2[0]) <= 100) {
if (Math.abs(position1[1] - position2[1]) <= 50) {