Skip to content

Commit

Permalink
Fix toggleBtn issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alex2wong committed May 2, 2019
1 parent 7d519ec commit 7a258b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h4>Game of Throne 3d Map</h4>
<div id='map'></div>
<div class="toggleBtn">
<input type="checkbox" name="toggleTerrain" id="toggleTerrain"
onchange="toggleTerrain()" checked>
onchange="toggleTerrain()" checked disabled>
<label for="toggleTerrain">toggle terrain</label>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/textureloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ function addTexture(texture) {
bufferPlaneMesh.rotation.x -= Math.PI / 2
bufferPlaneMesh.receiveShadow = true;
scene.add(bufferPlaneMesh);
var toggleBtn = document.querySelector('#toggleTerrain');
if (toggleBtn) {
toggleBtn.disabled = false;
}
var statusBar = document.querySelector("#reset");
if (statusBar) {
statusBar.innerHTML = "receive data completed.";
Expand All @@ -98,7 +102,9 @@ function addTexture(texture) {
}

function toggleTerrain() {
bufferPlaneMesh.visible = !bufferPlaneMesh.visible;
if (bufferPlaneMesh) {
bufferPlaneMesh.visible = !bufferPlaneMesh.visible;
}
}

function customObj3d() {
Expand Down

0 comments on commit 7a258b8

Please sign in to comment.