Skip to content

Commit

Permalink
Don't show slots connecting cancelling while not connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
andev0 committed Aug 31, 2024
1 parent 87e006a commit ed66484
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<p id="ratio-display">Zoom: 1.0x</p>
</div>
<div class="row">
<div class="button hidden" id="cancel-linking" title="Cancel connecting nodes">
<svg class="unlink_icon-placeholder"></svg>
</div>
<div class="button" id="open-help" title="Help">
<svg class="question-mark_icon-placeholder"></svg>
</div>
<div class="button" id="cancel-linking" title="Cancel connecting nodes">
<svg class="unlink_icon-placeholder"></svg>
</div>
<div class="button toggle off" id="grid-toggle" title="Toggle grid">
<svg class="off grid_icon-placeholder"></svg>
<svg class="on disable-grid_icon-placeholder"></svg>
Expand Down Expand Up @@ -473,6 +473,10 @@ <h2 class="title">Help <span class="background">&nbsp;&nbsp;&nbsp;&nbsp;(⩾﹏

<div id="canvas-context-menu-container" class="context-menu-container hidden">
<div class="context-menu">
<div class="option hidden" id="cancel-linking-option">
<svg class="unlink_icon-placeholder"></svg>
<div class="text">Cancel connecting nodes</div>
</div>
<div class="option" id="create-node-option">
<svg class="plus_icon-placeholder"></svg>
<div class="text">Create node</div>
Expand All @@ -497,10 +501,6 @@ <h2 class="title">Help <span class="background">&nbsp;&nbsp;&nbsp;&nbsp;(⩾﹏
<div class="text">Enable grid</div>
</div>
</div>
<div class="option" id="cancel-linking-option">
<svg class="unlink_icon-placeholder"></svg>
<div class="text">Cancel connecting nodes</div>
</div>
<div class="option" id="show-help-option">
<svg class="question-mark_icon-placeholder"></svg>
<div class="text">Show help</div>
Expand Down
6 changes: 6 additions & 0 deletions src/MouseHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export class MouseHandler
this.slotConnectingCurve = undefined;
this.mouseStatus = MouseHandler.MouseStatus.Free;
Settings.instance.connectingResource = undefined;

document.querySelector(".controls #cancel-linking")!.classList.add("hidden");
document.querySelector("#canvas-context-menu-container #cancel-linking-option")!.classList.add("hidden");
}
}

Expand Down Expand Up @@ -231,6 +234,9 @@ export class MouseHandler
this.slotConnectingLine.setAttribute("d", path);

this.viewport.appendChild(this.slotConnectingLine);

document.querySelector(".controls #cancel-linking")!.classList.remove("hidden");
document.querySelector("#canvas-context-menu-container #cancel-linking-option")!.classList.remove("hidden");
}

public startDraggingNode(node: SankeyNode, position: Point)
Expand Down

0 comments on commit ed66484

Please sign in to comment.