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', 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) => { this.instance.bind('connection', (info: OnConnectionBindInfo) => {
info.connection.setConnector(CONNECTOR_TYPE_FLOWCHART); info.connection.setConnector(CONNECTOR_TYPE_FLOWCHART);
info.connection.setPaintStyle(CONNECTOR_PAINT_STYLE_DEFAULT); info.connection.setPaintStyle(CONNECTOR_PAINT_STYLE_DEFAULT);
@ -1504,13 +1507,16 @@ 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) {
// Display the connection-delete button only on hover
let timer: NodeJS.Timeout | undefined; let timer: NodeJS.Timeout | undefined;
info.connection.bind('mouseover', (connection: IConnection) => { info.connection.bind('mouseover', (connection: IConnection) => {
if (timer !== undefined) { if (timer !== undefined) {
clearTimeout(timer); clearTimeout(timer);
} }
if (hideVisibleActions) {
hideVisibleActions();
}
showOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID); showOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
hideOverlay(info.connection, OVERLAY_RUN_ITEMS_ID); hideOverlay(info.connection, OVERLAY_RUN_ITEMS_ID);
if (!info.connection.getOverlay(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) => { info.connection.bind('mouseout', (connection: IConnection) => {
hideVisibleActions = () => {
hideVisibleActions = null;
hideOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID);
showOrHideItemsLabel(info.connection);
showOrHideMidpointArrow(info.connection);
};
timer = setTimeout(() => { timer = setTimeout(() => {
if (!info.connection) { if (!info.connection) {
return; return;
} }
timer = undefined; timer = undefined;
hideOverlay(info.connection, OVERLAY_CONNECTION_ACTIONS_ID); if (hideVisibleActions) {
showOrHideItemsLabel(info.connection); hideVisibleActions();
showOrHideMidpointArrow(info.connection); }
}, 500); }, 500);
}); });