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

Update main.js

Browse files
Files changed (1) hide show
  1. main.js +39 -21
main.js CHANGED
@@ -180,7 +180,10 @@ document.addEventListener('DOMContentLoaded', () => {
180
 
181
  // --- EVENT LISTENERS ---
182
 
183
- arToggle.addEventListener('click', () => toggleARView(!arActive));
 
 
 
184
  const sceneEl = document.querySelector('a-scene');
185
  if (sceneEl) {
186
  sceneEl.addEventListener('click', (event) => {
@@ -190,12 +193,43 @@ document.addEventListener('DOMContentLoaded', () => {
190
  }
191
  });
192
  }
 
 
193
  if(closeObjectModal) closeObjectModal.addEventListener('click', () => objectModal.classList.add('hidden'));
 
 
194
  if(sendBtn) sendBtn.addEventListener('click', handleSearch);
195
  if(userInput) userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleSearch(); });
196
- if(settingsBtn) settingsBtn.addEventListener('click', () => { settingsModal.classList.remove('hidden'); });
197
- if(closeSettingsModal) closeSettingsModal.addEventListener('click', () => { settingsModal.classList.add('hidden'); });
198
- if(settingsModal) settingsModal.addEventListener('click', (event) => { if (event.target === settingsModal) { settingsModal.classList.add('hidden'); } });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  const settingToggles = settingsModal ? settingsModal.querySelectorAll('input[data-setting]') : [];
200
  settingToggles.forEach(toggle => {
201
  const settingName = toggle.dataset.setting;
@@ -203,25 +237,9 @@ document.addEventListener('DOMContentLoaded', () => {
203
  toggle.addEventListener('change', (event) => {
204
  const changedSettingName = event.target.dataset.setting;
205
  userSettings[changedSettingName] = event.target.checked;
206
- // console.log('Settings updated:', userSettings); // You can re-enable this for testing
207
  });
208
  });
209
- // --- Glasses Modal Open/Close ---
210
- if (glassesBtn && glassesModal && closeGlassesModal) {
211
- glassesBtn.addEventListener('click', () => {
212
- glassesModal.classList.remove('hidden');
213
- });
214
-
215
- closeGlassesModal.addEventListener('click', () => {
216
- glassesModal.classList.add('hidden');
217
- });
218
-
219
- glassesModal.addEventListener('click', (event) => {
220
- if (event.target === glassesModal) {
221
- glassesModal.classList.add('hidden');
222
- }
223
- });
224
- }
225
 
226
  // --- INITIALIZATION ---
227
  fetchPoisAndCreateAREntities();
 
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) => {
 
193
  }
194
  });
195
  }
196
+
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');
219
+ });
220
+ }
221
+ if (closeGlassesModal) {
222
+ closeGlassesModal.addEventListener('click', () => {
223
+ if(glassesModal) glassesModal.classList.add('hidden');
224
+ });
225
+ }
226
+ if (glassesModal) {
227
+ glassesModal.addEventListener('click', (event) => {
228
+ if (event.target === glassesModal) glassesModal.classList.add('hidden');
229
+ });
230
+ }
231
+
232
+ // Settings Toggles Functionality
233
  const settingToggles = settingsModal ? settingsModal.querySelectorAll('input[data-setting]') : [];
234
  settingToggles.forEach(toggle => {
235
  const settingName = toggle.dataset.setting;
 
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();