From e367e2c6206df982b87ef6602825554ca4495a0e Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:37:20 -0500 Subject: [PATCH] Add Warning and fix Undo Add a Warning when there are Zone not found and fix the Undo if the entity list selection has changed, then reset the undo stack cause it won't be applicable on the selection anymore. --- .../create/modules/renderWithZonesManager.html | 7 +++++++ .../create/modules/renderWithZonesManager.js | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/scripts/system/create/modules/renderWithZonesManager.html b/scripts/system/create/modules/renderWithZonesManager.html index afc6627232f..03dd4601599 100644 --- a/scripts/system/create/modules/renderWithZonesManager.html +++ b/scripts/system/create/modules/renderWithZonesManager.html @@ -91,6 +91,13 @@ td.lineInverted { color: #000000; } + div.warning { + color: #ff5900; + padding: 2px; + margin: 3px; + font-family: Raleway-Regular; + font-size: 12px; + } a { font-size: 22px; font-weight: 500; diff --git a/scripts/system/create/modules/renderWithZonesManager.js b/scripts/system/create/modules/renderWithZonesManager.js index ee1ec1d2631..49dec2bdf34 100644 --- a/scripts/system/create/modules/renderWithZonesManager.js +++ b/scripts/system/create/modules/renderWithZonesManager.js @@ -24,6 +24,9 @@ const RWZ_ZONE_SCAN_RADIUS = 27713; //maximal radius to cover the entire domain. let rwzmOverlayWebWindow = null; function renderWithZonesManager(entityIDs, highlightedID = "") { + if (rwzmGetCheckSum(entityIDs) !== rwzmGetCheckSum(rwzmSelectedId)) { + rwzmUndo = []; + } rwzmSelectedId = entityIDs; if (entityIDs.length === 0) { audioFeedback.rejection(); @@ -75,6 +78,16 @@ function renderWithZonesManager(entityIDs, highlightedID = "") { rwzmGenerateUI(highlightedID); } + +function rwzmGetCheckSum(array) { + let i = 0; + let sum = 0; + let strForm = JSON.stringify(array); + for (i = 0; i < strForm.length; i++) { + sum = sum + strForm.charCodeAt(i); + } + return sum; +} function uiHasClosed() { rwzmOverlayWebWindow.closed.disconnect(uiHasClosed); rwzmOverlayWebWindow.webEventReceived.disconnect(webEventReceiver); @@ -96,6 +109,7 @@ function rwzmGenerateUI(highlightedID) { let addAction = ""; let toHighlight = ""; let viewBtnCaption = ""; + let warning = false; uiContent = uiContent + '

RenderWithZones Manager


\n'; if (canUnlock) { if (enforceLocked) { @@ -123,6 +137,7 @@ function rwzmGenerateUI(highlightedID) { if (name === "") { name = rwzmGenerateUnidentifiedZoneName(rwzmUsedZonesList[i]); elementClass = "errorline"; + warning = true; } toHighlight = rwzmUsedZonesList[i]; viewBtnCaption = "View"; @@ -201,6 +216,9 @@ function rwzmGenerateUI(highlightedID) { uiContent = uiContent + ' \n'; uiContent = uiContent + ' \n'; uiContent = uiContent + ' \n'; + if (warning) { + uiContent = uiContent + '
WARNING: The "ZONE NOT FOUND" visibility zones might simply not be loaded if too far and small. Please, verify before.
\n'; + } //Zone selector Add uiContent = uiContent + '
\n'; uiContent = uiContent + '

Select the zone to add:

\n';