fix: Settings popup close on mobile, remove reset scale button
This commit is contained in:
13
index.html
13
index.html
@ -114,16 +114,9 @@
|
|||||||
<span class="material-symbols-outlined text-sm">fit_screen</span>
|
<span class="material-symbols-outlined text-sm">fit_screen</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Settings Popup -->
|
<!-- Settings Popup -->
|
||||||
<div class="hidden absolute bottom-10 right-0 bg-[#1a2333] border border-[#2d3a4f] rounded-lg py-2 z-50 w-64 shadow-xl text-sm" id="settingsPopup">
|
<div class="hidden absolute bottom-10 right-0 bg-[#1a2333] border border-[#2d3a4f] rounded-lg py-2 z-50 w-64 shadow-xl text-sm" id="settingsPopup">
|
||||||
<!-- Reset Scale -->
|
<!-- Scale Toggles -->
|
||||||
<div class="px-4 py-2 hover:bg-[#252f3f] cursor-pointer flex items-center gap-3" onclick="window.dashboard.chart.timeScale().fitContent()">
|
|
||||||
<span class="material-symbols-outlined text-sm">refresh</span> Reset price scale
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr class="border-[#2d3a4f] my-1">
|
|
||||||
|
|
||||||
<!-- Scale Toggles -->
|
|
||||||
<div class="px-4 py-2 hover:bg-[#252f3f] cursor-pointer" onclick="window.toggleScaleOption('autoScale')">
|
<div class="px-4 py-2 hover:bg-[#252f3f] cursor-pointer" onclick="window.toggleScaleOption('autoScale')">
|
||||||
<span id="autoScaleCheck">✓</span> Auto (fits data to screen)
|
<span id="autoScaleCheck">✓</span> Auto (fits data to screen)
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -506,14 +506,29 @@ constructor() {
|
|||||||
if (btnSettings && settingsPopup) {
|
if (btnSettings && settingsPopup) {
|
||||||
btnSettings.addEventListener('click', (e) => {
|
btnSettings.addEventListener('click', (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
settingsPopup.classList.toggle('hidden');
|
settingsPopup.classList.remove('hidden');
|
||||||
|
settingsPopup.classList.add('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close popup when clicking outside on desktop
|
||||||
document.addEventListener('click', (e) => {
|
document.addEventListener('click', (e) => {
|
||||||
if (!settingsPopup.contains(e.target) && e.target !== btnSettings) {
|
if (!settingsPopup.contains(e.target) && !btnSettings.contains(e.target)) {
|
||||||
settingsPopup.classList.add('hidden');
|
settingsPopup.classList.add('hidden');
|
||||||
|
settingsPopup.classList.remove('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close popup when clicking on settings items (mobile)
|
||||||
|
settingsPopup.addEventListener('click', (e) => {
|
||||||
|
// Don't close if clicking on input elements or their containers
|
||||||
|
if (e.target.tagName === 'INPUT' || e.target.tagName === 'SELECT' || e.target.tagName === 'BUTTON' || e.target.closest('input') || e.target.closest('select') || e.target.closest('button')) {
|
||||||
|
e.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Close on click inside popup (for mobile touch)
|
||||||
|
settingsPopup.classList.add('hidden');
|
||||||
|
settingsPopup.classList.remove('show');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize state from storage
|
// Initialize state from storage
|
||||||
|
|||||||
Reference in New Issue
Block a user