|
5 | 5 | // This file contains all UI-related functionality for the floating panel, |
6 | 6 | // including creation, layout, drag behavior, and button moving logic. |
7 | 7 | // It extends the window.MaxExtensionFloatingPanel namespace with the corresponding methods. |
| 8 | +// |
| 9 | +// Key Components: |
| 10 | +// 1. Panel Creation - Creates the panel with header, content area, and profile switcher |
| 11 | +// 2. Drag Behavior - Makes the panel draggable by the header or footer |
| 12 | +// 3. Panel Visibility - Toggles the panel and handles state persistence |
| 13 | +// 4. Button Movement - Moves buttons between the original container and floating panel |
| 14 | +// 5. Profile Switching UI - Creates and manages the profile dropdown in the panel footer |
| 15 | +// |
| 16 | +// Key Methods: |
| 17 | +// - createFloatingPanel(): Creates the panel DOM structure with styling |
| 18 | +// - makeDraggable(): Adds drag functionality to specified elements |
| 19 | +// - togglePanel(): Handles panel visibility toggling and button movement |
| 20 | +// - moveButtonsToPanel(): Moves buttons from their original container to the panel |
| 21 | +// - restorePanelState(): Ensures panel visibility matches saved settings |
| 22 | +// - positionPanelAtCursor(): Positions the panel relative to mouse cursor |
| 23 | +// - createPanelToggleButton(): Creates the button that summons the floating panel |
| 24 | +// |
| 25 | +// Known Issues & Fixes: |
| 26 | +// - The togglePanel() method avoids loadPanelSettings() when initially creating the panel |
| 27 | +// to prevent race conditions that could cause the panel to disappear after summoning |
| 28 | +// - restorePanelState() only toggles the panel if its current state doesn't match the desired state |
| 29 | +// to prevent unintended toggling when loading settings |
| 30 | +// |
| 31 | +// Dependencies: |
| 32 | +// - floating-panel.js: Provides the namespace and shared properties |
| 33 | +// - floating-panel-settings.js: Provides settings management methods |
| 34 | +// - utils.js: For logging functionality |
8 | 35 |
|
9 | 36 | 'use strict'; |
10 | 37 |
|
|
0 commit comments