1
0
Fork 0
mirror of https://github.com/n8n-io/n8n.git synced 2025-02-02 07:01:30 -08:00

only one action at a time

This commit is contained in:
Mutasem 2021-10-25 12:10:06 +02:00
parent 8be32725a1
commit cfacc76b77

View file

@ -1479,6 +1479,9 @@ export default mixins(
eventSource: 'node_connection_drop',
}));
// only one set of visible actions should be visible at the same time
let hideVisibleActions: null | Function = null;
this.instance.bind('connection', (info: OnConnectionBindInfo) => {
info.connection.setConnector(CONNECTOR_TYPE_FLOWCHART);
info.connection.setPaintStyle(CONNECTOR_PAINT_STYLE_DEFAULT);
@ -1504,13 +1507,16 @@ export default mixins(
info.connection.removeOverlay(OVERLAY_DROP_NODE_ID);
if (this.isReadOnly === false) {
// Display the connection-delete button only on hover
let timer: NodeJS.Timeout | undefined;
info.connection.bind('mouseover', (connection: IConnection) => {
if (timer !== undefined) {
clearTimeout(timer);
}
if (hideVisibleActions) {
hideVisibleActions();
}
showOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
hideOverlay(info.connection, OVERLAY_RUN_ITEMS_ID);
if (!info.connection.getOverlay(OVERLAY_RUN_ITEMS_ID)) {
@ -1519,15 +1525,22 @@ export default mixins(
});
info.connection.bind('mouseout', (connection: IConnection) => {
hideVisibleActions = () => {
hideVisibleActions = null;
hideOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
showOrHideItemsLabel(info.connection);
showOrHideMidpointArrow(info.connection);
};
timer = setTimeout(() => {
if (!info.connection) {
return;
}
timer = undefined;
hideOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
showOrHideItemsLabel(info.connection);
showOrHideMidpointArrow(info.connection);
if (hideVisibleActions) {
hideVisibleActions();
}
}, 500);
});