lyunm1206 commited on
Commit
02d5b93
·
1 Parent(s): e2d8e2d
Files changed (1) hide show
  1. script.js +15 -10
script.js CHANGED
@@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', function() {
3
  const modelViewer2 = document.getElementById('modelViewer2');
4
  const toggleOptions = document.querySelectorAll('input[name="toggleOption"]');
5
  const allSubOptionGroups = document.querySelectorAll('.sub-options');
 
6
 
7
  function updateModels() {
8
  // Determine the active sub-option group
@@ -63,25 +64,29 @@ document.addEventListener('DOMContentLoaded', function() {
63
  return { model1Path: 'landscape/clic02_50_ori.gltf', model2Path: 'landscape/clic02_50_sh.gltf' };
64
  case 'option7b':
65
  return { model1Path: 'landscape/clic02_30_ori.gltf', model2Path: 'landscape/clic02_30_sh.gltf' };
66
- // Add cases for other sub-options
67
- default:
68
- return { model1Path: 'default_model1.glb', model2Path: 'default_model2.glb' };
69
  }
70
  }
71
 
72
- [option1, option2].forEach(option => {
73
- option.addEventListener('change', function() {
74
- // Uncheck other options
75
- option1.checked = option2.checked = false;
76
- this.checked = true;
77
- updateModels();
78
  });
79
- });
80
 
81
  toggleOptions.forEach(option => option.addEventListener('change', () => {
82
  updateSubOptionsDisplay();
83
  updateModels();
84
  }));
85
 
 
 
 
 
 
 
86
  updateModels();
 
87
  });
 
3
  const modelViewer2 = document.getElementById('modelViewer2');
4
  const toggleOptions = document.querySelectorAll('input[name="toggleOption"]');
5
  const allSubOptionGroups = document.querySelectorAll('.sub-options');
6
+ const allSubOptions = document.querySelectorAll('.sub-options input[type="radio"]');
7
 
8
  function updateModels() {
9
  // Determine the active sub-option group
 
64
  return { model1Path: 'landscape/clic02_50_ori.gltf', model2Path: 'landscape/clic02_50_sh.gltf' };
65
  case 'option7b':
66
  return { model1Path: 'landscape/clic02_30_ori.gltf', model2Path: 'landscape/clic02_30_sh.gltf' };
67
+
 
 
68
  }
69
  }
70
 
71
+ function uncheckAllSubOptions(exceptValue) {
72
+ allSubOptions.forEach(option => {
73
+ if (option.value !== exceptValue) {
74
+ option.checked = false;
75
+ }
 
76
  });
77
+ }
78
 
79
  toggleOptions.forEach(option => option.addEventListener('change', () => {
80
  updateSubOptionsDisplay();
81
  updateModels();
82
  }));
83
 
84
+ allSubOptions.forEach(option => option.addEventListener('change', function() {
85
+ uncheckAllSubOptions(this.value);
86
+ updateModels();
87
+ }));
88
+
89
+ updateSubOptionsDisplay();
90
  updateModels();
91
+
92
  });