mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
add enter delay
This commit is contained in:
parent
ae04eb6150
commit
8de96a346c
|
@ -1481,7 +1481,25 @@ export default mixins(
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// only one set of visible actions should be visible at the same time
|
// only one set of visible actions should be visible at the same time
|
||||||
let hideVisibleActions: null | Function = null;
|
let activeConnection: null | Connection = null;
|
||||||
|
|
||||||
|
const hideActions = (connection: Connection | null) => {
|
||||||
|
if (connection) {
|
||||||
|
hideOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
|
||||||
|
showOrHideItemsLabel(connection);
|
||||||
|
showOrHideMidpointArrow(connection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const showActions = (connection: Connection | null) => {
|
||||||
|
if (connection) {
|
||||||
|
showOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
|
||||||
|
hideOverlay(connection, OVERLAY_RUN_ITEMS_ID);
|
||||||
|
if (!connection.getOverlay(OVERLAY_RUN_ITEMS_ID)) {
|
||||||
|
hideOverlay(connection, OVERLAY_MIDPOINT_ARROW_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.instance.bind('connection', (info: OnConnectionBindInfo) => {
|
this.instance.bind('connection', (info: OnConnectionBindInfo) => {
|
||||||
info.connection.setConnector(CONNECTOR_TYPE_FLOWCHART);
|
info.connection.setConnector(CONNECTOR_TYPE_FLOWCHART);
|
||||||
|
@ -1508,39 +1526,51 @@ export default mixins(
|
||||||
info.connection.removeOverlay(OVERLAY_DROP_NODE_ID);
|
info.connection.removeOverlay(OVERLAY_DROP_NODE_ID);
|
||||||
|
|
||||||
if (this.isReadOnly === false) {
|
if (this.isReadOnly === false) {
|
||||||
let timer: NodeJS.Timeout | undefined;
|
let exitTimer: NodeJS.Timeout | undefined;
|
||||||
info.connection.bind('mouseover', (connection: IConnection) => {
|
let enterTimer: NodeJS.Timeout | undefined;
|
||||||
if (timer !== undefined) {
|
info.connection.bind('mouseover', (connection: Connection) => {
|
||||||
clearTimeout(timer);
|
if (exitTimer !== undefined) {
|
||||||
|
clearTimeout(exitTimer);
|
||||||
|
exitTimer = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideVisibleActions) {
|
if (enterTimer) {
|
||||||
hideVisibleActions();
|
|
||||||
}
|
|
||||||
|
|
||||||
showOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
|
|
||||||
hideOverlay(info.connection, OVERLAY_RUN_ITEMS_ID);
|
|
||||||
if (!info.connection.getOverlay(OVERLAY_RUN_ITEMS_ID)) {
|
|
||||||
hideOverlay(info.connection, OVERLAY_MIDPOINT_ARROW_ID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
timer = undefined;
|
|
||||||
|
|
||||||
if (hideVisibleActions) {
|
if (info.connection === activeConnection) {
|
||||||
hideVisibleActions();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hideActions(activeConnection);
|
||||||
|
|
||||||
|
enterTimer = setTimeout(() => {
|
||||||
|
enterTimer = undefined;
|
||||||
|
activeConnection = info.connection;
|
||||||
|
showActions(info.connection);
|
||||||
|
}, 150);
|
||||||
|
});
|
||||||
|
|
||||||
|
info.connection.bind('mouseout', (connection: Connection) => {
|
||||||
|
if (exitTimer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enterTimer) {
|
||||||
|
clearTimeout(enterTimer);
|
||||||
|
enterTimer = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeConnection !== info.connection) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exitTimer = setTimeout(() => {
|
||||||
|
exitTimer = undefined;
|
||||||
|
|
||||||
|
if (activeConnection === info.connection) {
|
||||||
|
hideActions(activeConnection);
|
||||||
|
activeConnection = null;
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue