From 580115957dc2aabe845c634455b2e1b680ba83c2 Mon Sep 17 00:00:00 2001
From: BujarMuharemi <bujar.muharemi.28@gmail.com>
Date: Sat, 4 Dec 2021 11:52:02 +0100
Subject: [PATCH] roof shadow color get reset, when changing modes

---
 public/js/globe.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/public/js/globe.js b/public/js/globe.js
index 981bf1f..e2f36be 100644
--- a/public/js/globe.js
+++ b/public/js/globe.js
@@ -273,7 +273,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
 
     //Surface View
     if (document.getElementById("surface").checked) {
-
+        resetRoofColors();
         //save the selected feature's original color
         if (pickedhigh) {
             highlightedFeatures.forEach(h => {
@@ -339,6 +339,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
 
     //Building View
     else if(document.getElementById("building").checked){
+        resetRoofColors();
         //save the selected feature's original color
         if (pickedhigh) {
             highlightedFeatures.forEach(h => {
@@ -480,3 +481,16 @@ function fillTableProperties(gID, sID) {
     }
 
 }
+
+
+function resetRoofColors(){
+    tileContent.forEach(t => {
+        if(t.getProperty("description").includes("Roof")){           
+            for (const [key, value] of Object.entries(shadowdata)) { 
+                if(key === t.getProperty("gml_id")){                 
+                    t.color = Cesium.Color.WHITE;                        
+                }
+            }            
+        }        
+    });
+}
-- 
GitLab