From 082b722eedd437e9281507798a16cb5d07cedf86 Mon Sep 17 00:00:00 2001 From: MatCat Date: Fri, 12 Mar 2021 00:39:43 -0800 Subject: [PATCH] 0.4.9: Fixed hang bug when visible work area got full of elements and a new one was attempted to be placed --- README.md | 4 ++++ js/globalfunctions.js | 4 +++- js/main.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1cf1096..64f1913 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ LZ-String, Copyright 2013 pieroxy under MIT license https://github.com/pieroxy/l ## Changelog +### 0.4.9 + +* Fixed a bug where the JS engine would hang if attempting to place a new element when the visual work area is too full of elements. + ### 0.4.8 * Fixed bug where disconnects where not propagating properly diff --git a/js/globalfunctions.js b/js/globalfunctions.js index 426e5e7..c9b3e95 100644 --- a/js/globalfunctions.js +++ b/js/globalfunctions.js @@ -12,7 +12,9 @@ function addElement(RestoreData = null,refClass,props) { let height = newElement.Height; let noclearspot = true; - while (noclearspot) { + let findattempt = 0; + while (noclearspot && findattempt < 100) { + findattempt++; if (!logicEngine.ActiveContainer.checkOverlayBounds(x, y, width, height)) { noclearspot = false; } else { diff --git a/js/main.js b/js/main.js index 8c5f05a..db8e155 100644 --- a/js/main.js +++ b/js/main.js @@ -2,7 +2,7 @@ MatCat BrowserLogic Simulator */ -let Version = "0.4.8"; +let Version = "0.4.9"; let spanVersion = document.getElementById("version"); spanVersion.innerText = Version; // get the canvas and get the engine object going