drag-pane

Featured

Drag-and-drop pane resizing implementation for two-pane plugin layouts. Covers mouse event handling via the internal/mouse package, hit region registration, drag delta calculation, width clamping, state persistence, and pane layout management. Use when working on pane resizing, drag interactions, layout management, or adding drag-to-resize to a new plugin.

AI & Automation 1,041 stars 80 forks Updated today MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Drag-to-Resize Pane Implementation ## Overview Add drag-to-resize support for two-pane plugin layouts (sidebar + main content). Users click and drag the divider between panes to resize them. ## Prerequisites - Plugin already has a two-pane layout (sidebar + main content) - State persistence functions exist in `internal/state/state.go` (each plugin has its own getter/setter) - Familiarity with `internal/mouse` package ## Existing Implementations | Plugin | State Functions | Mouse File | |--------|----------------|------------| | FileBrowser | `GetFileBrowserTreeWidth()` / `SetFileBrowserTreeWidth()` | `internal/plugins/filebrowser/mouse.go` | | GitStatus | `GetGitStatusSidebarWidth()` / `SetGitStatusSidebarWidth()` | `internal/plugins/gitstatus/mouse.go` | | Conversations | `GetConversationsSideWidth()` / `SetConversationsSideWidth()` | `internal/plugins/conversations/mouse.go` | | Workspace | `GetWorkspaceSidebarWidth()` / `SetWorkspaceSidebarWidth()` | `internal/plugins/workspace/view_list.go` | ## Implementation Steps ### Step 1: Add Mouse Handler to Plugin Struct ```go import "github.com/marcus/sidecar/internal/mouse" type Plugin struct { // ... other fields mouseHandler *mouse.Handler sidebarWidth int // Current sidebar width (persisted) } func New() *Plugin { return &Plugin{ mouseHandler: mouse.NewHandler(), } } ``` ### Step 2: Define Hit Region Constants ```go const ( regionSidebar = "sidebar" regionMainPane = "...

Details

Author
marcus
Repository
marcus/sidecar
Created
7 months ago
Last Updated
today
Language
Go
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category