privateuserh commited on
Commit
62afeca
·
verified ·
1 Parent(s): 1e8a708

Update main.js

Browse files
Files changed (1) hide show
  1. main.js +21 -16
main.js CHANGED
@@ -178,12 +178,12 @@ document.addEventListener('DOMContentLoaded', () => {
178
  }
179
  }
180
 
181
- // --- EVENT LISTENERS ---
182
 
183
  // AR Mode Toggle
184
  if(arToggle) arToggle.addEventListener('click', () => toggleARView(!arActive));
185
 
186
- // Clicking on AR objects
187
  const sceneEl = document.querySelector('a-scene');
188
  if (sceneEl) {
189
  sceneEl.addEventListener('click', (event) => {
@@ -197,22 +197,28 @@ document.addEventListener('DOMContentLoaded', () => {
197
  // Info Modal Close Button
198
  if(closeObjectModal) closeObjectModal.addEventListener('click', () => objectModal.classList.add('hidden'));
199
 
200
- // Search Bar
201
  if(sendBtn) sendBtn.addEventListener('click', handleSearch);
202
  if(userInput) userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleSearch(); });
203
 
204
- // Settings Modal Open/Close
205
- if(settingsBtn) settingsBtn.addEventListener('click', () => {
206
- if(settingsModal) settingsModal.classList.remove('hidden');
207
- });
208
- if(closeSettingsModal) closeSettingsModal.addEventListener('click', () => {
209
- if(settingsModal) settingsModal.classList.add('hidden');
210
- });
211
- if(settingsModal) settingsModal.addEventListener('click', (event) => {
212
- if (event.target === settingsModal) settingsModal.classList.add('hidden');
213
- });
 
 
 
 
 
 
214
 
215
- // Glasses Modal Open/Close
216
  if (glassesBtn) {
217
  glassesBtn.addEventListener('click', () => {
218
  if(glassesModal) glassesModal.classList.remove('hidden');
@@ -237,10 +243,9 @@ document.addEventListener('DOMContentLoaded', () => {
237
  toggle.addEventListener('change', (event) => {
238
  const changedSettingName = event.target.dataset.setting;
239
  userSettings[changedSettingName] = event.target.checked;
240
- console.log('Settings updated:', userSettings);
241
  });
242
  });
243
-
244
  // --- INITIALIZATION ---
245
  fetchPoisAndCreateAREntities();
246
  });
 
178
  }
179
  }
180
 
181
+ // --- EVENT LISTENERS (Corrected Version) ---
182
 
183
  // AR Mode Toggle
184
  if(arToggle) arToggle.addEventListener('click', () => toggleARView(!arActive));
185
 
186
+ // Clicking on AR objects in the scene
187
  const sceneEl = document.querySelector('a-scene');
188
  if (sceneEl) {
189
  sceneEl.addEventListener('click', (event) => {
 
197
  // Info Modal Close Button
198
  if(closeObjectModal) closeObjectModal.addEventListener('click', () => objectModal.classList.add('hidden'));
199
 
200
+ // Search Bar Send Button & Enter Key
201
  if(sendBtn) sendBtn.addEventListener('click', handleSearch);
202
  if(userInput) userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleSearch(); });
203
 
204
+ // Settings Modal Open/Close Logic
205
+ if(settingsBtn) {
206
+ settingsBtn.addEventListener('click', () => {
207
+ if(settingsModal) settingsModal.classList.remove('hidden');
208
+ });
209
+ }
210
+ if(closeSettingsModal) {
211
+ closeSettingsModal.addEventListener('click', () => {
212
+ if(settingsModal) settingsModal.classList.add('hidden');
213
+ });
214
+ }
215
+ if(settingsModal) {
216
+ settingsModal.addEventListener('click', (event) => {
217
+ if (event.target === settingsModal) settingsModal.classList.add('hidden');
218
+ });
219
+ }
220
 
221
+ // Glasses Modal Open/Close Logic
222
  if (glassesBtn) {
223
  glassesBtn.addEventListener('click', () => {
224
  if(glassesModal) glassesModal.classList.remove('hidden');
 
243
  toggle.addEventListener('change', (event) => {
244
  const changedSettingName = event.target.dataset.setting;
245
  userSettings[changedSettingName] = event.target.checked;
246
+ // console.log('Settings updated:', userSettings); // For testing
247
  });
248
  });
 
249
  // --- INITIALIZATION ---
250
  fetchPoisAndCreateAREntities();
251
  });