diff --git a/index.html b/index.html
index 9ce3490..4bc2320 100644
--- a/index.html
+++ b/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
document.addEventListener('DOMContentLoaded', () => {
const resizer = document.getElementById('mainChartResizer');
@@ -563,11 +577,29 @@
document.addEventListener('mousemove', (e) => doResize(e.clientY));
document.addEventListener('touchmove', (e) => doResize(e.touches[0].clientY), {passive: false});
- document.addEventListener('mouseup', endResize);
- document.addEventListener('touchend', endResize);
- document.addEventListener('touchcancel', endResize);
+ document.addEventListener('mouseup', endResize);
+ document.addEventListener('touchend', 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();
+ }
+ });
+ }
diff --git a/js/ui/chart.js b/js/ui/chart.js
index 20fb421..891beef 100644
--- a/js/ui/chart.js
+++ b/js/ui/chart.js
@@ -491,6 +491,11 @@ export class TradingDashboard {
this.renderTA();
}
});
+
+ // Hide indicators panel when clicking on chart
+ this.chart.subscribeClick(param => {
+ window.hideAllPanels?.();
+ });
window.addEventListener('resize', () => {
this.chart.applyOptions({