hide indicators panel when clicking on chart
This commit is contained in:
38
index.html
38
index.html
@ -503,6 +503,20 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.hideSidebar = function() {
|
||||||
|
const sidebar = document.getElementById('rightSidebar');
|
||||||
|
if (sidebar && !sidebar.classList.contains('collapsed')) {
|
||||||
|
sidebar.classList.add('collapsed');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.hideSidebarAndClearDrawings = function() {
|
||||||
|
window.hideSidebar();
|
||||||
|
if (window.dashboard?.drawingManager) {
|
||||||
|
window.dashboard.drawingManager.clearAll();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Chart Resizer Logic
|
// Chart Resizer Logic
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const resizer = document.getElementById('mainChartResizer');
|
const resizer = document.getElementById('mainChartResizer');
|
||||||
@ -563,11 +577,29 @@
|
|||||||
document.addEventListener('mousemove', (e) => doResize(e.clientY));
|
document.addEventListener('mousemove', (e) => doResize(e.clientY));
|
||||||
document.addEventListener('touchmove', (e) => doResize(e.touches[0].clientY), {passive: false});
|
document.addEventListener('touchmove', (e) => doResize(e.touches[0].clientY), {passive: false});
|
||||||
|
|
||||||
document.addEventListener('mouseup', endResize);
|
document.addEventListener('mouseup', endResize);
|
||||||
document.addEventListener('touchend', endResize);
|
document.addEventListener('touchend', endResize);
|
||||||
document.addEventListener('touchcancel', endResize);
|
document.addEventListener('touchcancel', endResize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide sidebar when clicking on chart container (but not on drawing toolbar or sidebar itself)
|
||||||
|
const chartWrapper = document.getElementById('chartWrapper');
|
||||||
|
if (chartWrapper) {
|
||||||
|
chartWrapper.addEventListener('click', function(e) {
|
||||||
|
const sidebar = document.getElementById('rightSidebar');
|
||||||
|
const drawingToolbar = document.getElementById('drawingToolbar');
|
||||||
|
|
||||||
|
if (!sidebar || sidebar.classList.contains('collapsed')) return;
|
||||||
|
|
||||||
|
const isDrawingToolbar = e.target.closest('#drawingToolbar');
|
||||||
|
const isSidebar = e.target.closest('#rightSidebar');
|
||||||
|
|
||||||
|
if (!isDrawingToolbar && !isSidebar) {
|
||||||
|
hideSidebar();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="./config.js"></script>
|
<script src="./config.js"></script>
|
||||||
|
|||||||
@ -492,6 +492,11 @@ export class TradingDashboard {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide indicators panel when clicking on chart
|
||||||
|
this.chart.subscribeClick(param => {
|
||||||
|
window.hideAllPanels?.();
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.chart.applyOptions({
|
this.chart.applyOptions({
|
||||||
width: chartContainer.clientWidth,
|
width: chartContainer.clientWidth,
|
||||||
|
|||||||
Reference in New Issue
Block a user