Skip to content

Commit

Permalink
Add Warning and fix Undo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AleziaKurdis authored Feb 3, 2024
1 parent c43bb11 commit e367e2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/system/create/modules/renderWithZonesManager.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions scripts/system/create/modules/renderWithZonesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -96,6 +109,7 @@ function rwzmGenerateUI(highlightedID) {
let addAction = "";
let toHighlight = "";
let viewBtnCaption = "";
let warning = false;
uiContent = uiContent + ' <h1>RenderWithZones Manager</h1><hr>\n';
if (canUnlock) {
if (enforceLocked) {
Expand Down Expand Up @@ -123,6 +137,7 @@ function rwzmGenerateUI(highlightedID) {
if (name === "") {
name = rwzmGenerateUnidentifiedZoneName(rwzmUsedZonesList[i]);
elementClass = "errorline";
warning = true;
}
toHighlight = rwzmUsedZonesList[i];
viewBtnCaption = "View";
Expand Down Expand Up @@ -201,6 +216,9 @@ function rwzmGenerateUI(highlightedID) {
uiContent = uiContent + ' </tr>\n';
uiContent = uiContent + ' </table></div>\n';
uiContent = uiContent + ' <input type = "hidden" id = "highlightedID" value = "' + highlightedID + '">\n';
if (warning) {
uiContent = uiContent + ' <div class="warning"><b>WARNING</b>: The "<b>ZONE NOT FOUND</b>" visibility zones might simply not be loaded if too far and small. Please, verify before.</div>\n';
}
//Zone selector Add
uiContent = uiContent + ' <div id="rwzmAddZoneSelector">\n';
uiContent = uiContent + ' <h2>Select the zone to add:</h2><div class="zoneSelectorContainer">\n';
Expand Down

0 comments on commit e367e2c

Please sign in to comment.