From a1e9d1200c1b41f6db8abc57c23661753a9d59bc Mon Sep 17 00:00:00 2001 From: MatCat Date: Mon, 8 Mar 2021 21:32:39 -0800 Subject: [PATCH] 0.4.4: Fixed selection bug and linking bug --- README.md | 5 +++++ js/elements.js | 2 +- js/logicengine.js | 5 ++++- js/main.js | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6848eb..8c0e61f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ To be decided, but at this moment this code is open source and free to use for n ## Changelog +### 0.4.4 + +* Fixed a delinking bug +* Fixed a bug where selection only worked in certain directions + ### 0.4.3 * There is now multi-selection, including movement, deleting, disconnecting, etc. diff --git a/js/elements.js b/js/elements.js index e1c5177..4b1b69a 100644 --- a/js/elements.js +++ b/js/elements.js @@ -302,8 +302,8 @@ class Element extends CanvasTools { if (this.OutputConnections[a].Element == element && this.OutputConnections[a].Input == input) { // Already existing link, we will remove it instead this.LogicEngine.RecursionCount = 0; - element.setInput(input,false); this.OutputConnections.splice(a,1); + element.setInput(input,false); return; } } diff --git a/js/logicengine.js b/js/logicengine.js index dad6f2b..5951997 100644 --- a/js/logicengine.js +++ b/js/logicengine.js @@ -148,7 +148,10 @@ class LogicEngine { this.MultiSelectStart.InProgress = false; let cmStartPos = {x: this.MultiSelectStart.x, y: this.MultiSelectStart.y}; let cmEndPos = this.getCanvasMousePos(mousePos); - this.ActiveContainer.SelectWithin(cmStartPos.x,cmStartPos.y,cmEndPos.x,cmEndPos.y); + this.ActiveContainer.SelectWithin((cmStartPos.x>cmEndPos.x) ? cmEndPos.x : cmStartPos.x, + (cmStartPos.y>cmEndPos.y) ? cmEndPos.y : cmStartPos.y, + (cmStartPos.x>cmEndPos.x) ? cmStartPos.x : cmEndPos.x, + (cmStartPos.y>cmEndPos.y) ? cmStartPos.y : cmEndPos.y); } if (this.ActiveContainer.Selected?.length > 0) { diff --git a/js/main.js b/js/main.js index b4679da..e4cc29c 100644 --- a/js/main.js +++ b/js/main.js @@ -2,7 +2,7 @@ MatCat BrowserLogic Simulator */ -let Version = "0.4.3"; +let Version = "0.4.4"; let spanVersion = document.getElementById("version"); spanVersion.innerText = Version; // get the canvas and get the engine object going