mirror of
https://github.com/sotam0316/drawNET.git
synced 2026-04-25 03:58:37 +09:00
Initial commit: drawNET Alpha v1.0 - Professional Topology Designer with Full i18n and Performance Optimizations
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { state } from '../state.js';
|
||||
|
||||
export function initSidebar() {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const sidebarToggle = document.getElementById('sidebar-toggle');
|
||||
const footer = document.querySelector('.sidebar-footer');
|
||||
|
||||
if (sidebarToggle && sidebar) {
|
||||
const toggleSidebar = () => {
|
||||
sidebar.classList.toggle('collapsed');
|
||||
if (footer) {
|
||||
footer.style.display = sidebar.classList.contains('collapsed') ? 'none' : 'block';
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (state.graph) state.graph.zoomToFit({ padding: 50 });
|
||||
}, 350);
|
||||
};
|
||||
|
||||
sidebarToggle.addEventListener('click', toggleSidebar);
|
||||
|
||||
const searchIcon = document.querySelector('.search-container i');
|
||||
if (searchIcon) {
|
||||
searchIcon.addEventListener('click', () => {
|
||||
if (sidebar.classList.contains('collapsed')) {
|
||||
toggleSidebar();
|
||||
document.getElementById('asset-search').focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user