add more checks

This commit is contained in:
Mutasem 2021-11-05 14:00:34 +01:00
parent 478e7dd30a
commit 2efeb8c51e
2 changed files with 9 additions and 8 deletions

View file

@ -1369,7 +1369,7 @@ export default mixins(
return; return;
} }
if (info.connection === activeConnection) { if (!info.connection || info.connection === activeConnection) {
return; return;
} }
@ -1378,9 +1378,10 @@ export default mixins(
enterTimer = setTimeout(() => { enterTimer = setTimeout(() => {
enterTimer = undefined; enterTimer = undefined;
activeConnection = info.connection; if (info.connection) {
CanvasHelpers.showConectionActions(info.connection); activeConnection = info.connection;
CanvasHelpers.showConectionActions(info.connection);
}
}, 150); }, 150);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -1398,14 +1399,14 @@ export default mixins(
enterTimer = undefined; enterTimer = undefined;
} }
if (activeConnection !== info.connection) { if (!info.connection || activeConnection !== info.connection) {
return; return;
} }
exitTimer = setTimeout(() => { exitTimer = setTimeout(() => {
exitTimer = undefined; exitTimer = undefined;
if (activeConnection === info.connection) { if (info.connection && activeConnection === info.connection) {
CanvasHelpers.hideConnectionActions(activeConnection); CanvasHelpers.hideConnectionActions(activeConnection);
activeConnection = null; activeConnection = null;
} }

View file

@ -380,7 +380,7 @@ export const getBackgroundStyles = (scale: number, offsetPosition: XYPosition) =
}; };
export const hideConnectionActions = (connection: Connection | null) => { export const hideConnectionActions = (connection: Connection | null) => {
if (connection) { if (connection && connection.connector) {
hideOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID); hideOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
showOrHideItemsLabel(connection); showOrHideItemsLabel(connection);
showOrHideMidpointArrow(connection); showOrHideMidpointArrow(connection);
@ -388,7 +388,7 @@ export const hideConnectionActions = (connection: Connection | null) => {
}; };
export const showConectionActions = (connection: Connection | null) => { export const showConectionActions = (connection: Connection | null) => {
if (connection) { if (connection && connection.connector) {
showOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID); showOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
hideOverlay(connection, OVERLAY_RUN_ITEMS_ID); hideOverlay(connection, OVERLAY_RUN_ITEMS_ID);
if (!getOverlay(connection, OVERLAY_RUN_ITEMS_ID)) { if (!getOverlay(connection, OVERLAY_RUN_ITEMS_ID)) {