Real-Time Mouse-Based Window Resizing - #130
Merged
Merged
Conversation
• Added SetBorderColor(tcell.Color) to FileBrowserComponent in file_browser.go.
• Added SetBorderColor(tcell.Color) to DatasetInfoComponent in dataset_info.go.
• Added SetBorderColor(tcell.Color) to SnapshotBrowserComponent in snapshot_browser.go.
• Added SetBorderColor(tcell.Color) wrapper inside LoadingContainer in data_loader.go.
2. Implemented coordinate tracking and resize interaction in main_page.go:
• Configured SetMouseCapture on the parent windowLayout .
• Used absolute screen coordinates from event.Position() and checked them against the widget rectangles returned by GetRect() .
• Enabled interactive boundary hover detection: highlighting the border of adjacent windows with theme.Primary (accent orange) when
the mouse is positioned on the boundaries.
• Handled MouseLeftDown click drags to dynamically scale flex row/column proportions using tview.Flex.ResizeItem , clamping panels
to safe minimum boundaries (minimum 10 columns for browser width, 4 rows for dataset info height, 5 rows for snapshot browser height).
• Released state tracking on MouseLeftUp or when buttons are released.
• Moved the mouse capture handler from windowLayout up to the top-level mainPageLayout . Because this spans the entire screen, fast mouse movements will never escape the captured region. • Added a 30ms rate-limiter (approx 33 FPS) that suppresses redundant intermediate layout calculations and screen redraws. • Integrated a trailing timer ( dragTimer via time.AfterFunc calling QueueUpdateDraw ) which guarantees that the final drag position is always visually captured and exact even if it fell within a rate-limited window. • Normal mouse events return action, nil (consumed but no redraw) during rate-limiting periods, drastically reducing CPU/network terminal redraw load. ### 2. Precise Boundary Highlighting (Adjacent Border Lines Only) • Reverted full panel border color changes to prevent the outer/non-adjacent sides of the windows from turning orange. • Utilized tview 's SetAfterDrawFunc hook to draw highlights. In this hook, we query the character cells directly from screen. GetContent(x, y) at the active boundary column/row and dynamically override their foreground color style to theme.Primary (accent orange) while leaving the characters, corners, junction lines, and background styles completely intact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request introduces real-time mouse resizing of the main three panels (File Browser, Dataset Info, and Snapshot Browser) in the terminal user interface (TUI). It enables smooth, visual border drag interactions while preventing deadlocks and terminal redraw flooding.
Key Features
1. Root-Level Mouse Drag Tracking
mainPageLayout) instead of individual window layouts.2. High-Performance Drag Mechanics (Lag & Flooding Prevention)
time.AfterFuncalongsideapplication.QueueUpdateDrawto queue a final resize update 30ms after the last motion event. This ensures the panel lands precisely at the final cursor drop location without dropping the last frame.action, nil(suppressing immediate frame redraws) rather than triggering full terminal rerenders on every mouse pixel moved.3. Precise Visual Border Highlighting
tview.Application.SetAfterDrawFunchook.theme.Primary(accent orange).theme.Colors.Layout.Border) when the mouse leaves.4. Layout Sizing Consistency
tview.Flex.ResizeItem.Code Structure Changes
MainPage.applyResizehelper to update layout item sizing proportions.SetMouseCaptureand application-wideSetAfterDrawFunccallbacks increateLayout.SetBorderColorwrapper forLoadingContainer.SetBorderColor(tcell.Color)helper methods to individual panel components.Validation & Deadlock Compliance
tviewto handle redraw evaluations at the end of the event loop.QueueUpdateDraw, preventing main-thread event loop deadlocks.go test ./...) pass successfully.