Skip to content

Commit

Permalink
Move showTerrain State to Scene #332
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianK13 committed Oct 18, 2024
1 parent 40d8f40 commit 8d7cef8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/components/ThreeViewer/Scene.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from "react"
import React, { useRef, useState } from "react"
import { Canvas } from "react-three-fiber"

import CustomMapControl from "./Controls/CustomMapControl"
Expand All @@ -19,8 +19,6 @@ const Scene = ({
geometries,
simulationMeshes,
setSimulationMeshes,
showTerrain,
setShowTerrain,
pvSystems,
setPVSystems,
selectedMesh,
Expand All @@ -32,6 +30,9 @@ const Scene = ({
vegetationGeometries,
geoLocation,
}) => {
// showTerrain decides if the underlying Map is visible or not
const [showTerrain, setShowTerrain] = useState(true)

window.setPVPoints = setPVPoints
const position = [
simulationMeshes[0].middle.x,
Expand Down
5 changes: 1 addition & 4 deletions src/pages/Simulation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ function Index() {

// frontendState defines the general state of the frontend (Results, Loading, DrawPV)
const [frontendState, setFrontendState] = useState("Loading")
// showTerrain decides if the underlying Map is visible or not
const [showTerrain, setShowTerrain] = useState(true)

// simulationProgress is used for the loading bar
const [simulationProgress, setSimulationProgress] = useState(0)
// A list of visible PV Systems - they get visible after they are drawn on a building and calculated
Expand Down Expand Up @@ -69,8 +68,6 @@ function Index() {
geometries={geometries}
simulationMeshes={simulationMeshes}
setSimulationMeshes={setSimulationMeshes}
showTerrain={showTerrain}
setShowTerrain={setShowTerrain}
pvSystems={pvSystems}
setPVSystems={setPVSystems}
selectedMesh={selectedMesh}
Expand Down

0 comments on commit 8d7cef8

Please sign in to comment.