Type Resizable

type Resizable struct {

	// pixel minimum of the first panel
	// pixel minimum of the second panel
	// arrow step in pixels; zero means 5% of the group
	// fraction Enter collapses to; negative means the minimum
	// defaultFraction is where a double click returns the handle.

}

Resizable paints a split handle, returns panel geometry, and maps pointer coordinates back to a constrained fraction. Fraction and drag ownership stay in application state, so an idle split owns no timer, goroutine, or polling work.

Constructors

BeginResizable#

func BeginResizable(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect, fraction float32) Resizable

BeginResizable starts a horizontal split declaration.

Methods

CollapseFraction#

func (resizable Resizable) CollapseFraction(current, restore float32, key ui.Key) (float32, bool)

CollapseFraction is Enter on a focused handle: collapse to Collapsed (the lower limit by default) when the panel is open, else restore restore, the size it had before. It is the caller's job to remember that size.

Collapsed#

func (resizable Resizable) Collapsed(fraction float32) Resizable

Collapsed sets the fraction Enter collapses the first panel to; the default is the lower limit.

Default#

func (resizable Resizable) Default(fraction float32) Resizable

Default sets the fraction a double click restores; the initial fraction is the default.

Disabled#

func (resizable Resizable) Disabled() Resizable

Disabled renders and routes the handle as inert.

FractionAt#

func (resizable Resizable) FractionAt(position float32) float32

FractionAt maps a caller-supplied x or y coordinate to a constrained split. The coordinate is x for horizontal layouts and y for vertical layouts.

FractionForClick#

func (resizable Resizable) FractionForClick(clickCount int) (float32, bool)

FractionForClick is the double-click reset: a click count of two or more returns Default constrained by the current limits, and reports whether it applied.

FractionForKey#

func (resizable Resizable) FractionForKey(key ui.Key) (float32, bool)

FractionForKey is the keyboard behavior of a focused handle: the arrows along the split's axis move it by Step pixels, or 5% of the group without a Step; Home and End send it to the lower and upper limit. It returns the new first-panel fraction and whether the key was one the handle uses.

HandleSize#

func (resizable Resizable) HandleSize(size float32) Resizable

HandleSize overrides the logical-pixel interaction strip thickness. Panel geometry always reserves the official one-pixel visual separator.

Limits#

func (resizable Resizable) Limits(minimum, maximum float32) Resizable

Limits constrains the first panel's fraction.

LimitsPx#

func (resizable Resizable) LimitsPx(minFirst, minSecond float32) Resizable

LimitsPx adds pixel minimums for the two panels (a panel's minSize in pixels, which is what a desktop sidebar or inspector wants) on top of Limits. Where the two cannot both hold, the pixel minimums win up to the room there is.

Paint#

func (resizable Resizable) Paint(label string) ResizableLayout

Paint draws the one-pixel separator and optional four-by-twenty-four grip. A hovered or pressed handle is drawn three pixels wide in the ring color (primary while pressed), the usual cue that a divider is draggable.

Step#

func (resizable Resizable) Step(pixels float32) Resizable

Step sets how many pixels an arrow key moves the handle by. Without it an arrow moves 5% of the group, as Base UI's resizable panel does.

ValueText#

func (resizable Resizable) ValueText(value string) Resizable

ValueText supplies caller-formatted accessibility value text without formatting or allocating in the paint path.

Vertical#

func (resizable Resizable) Vertical() Resizable

Vertical stacks the first panel above the second.

WithHandle#

func (resizable Resizable) WithHandle() Resizable

WithHandle adds the compact Vega grip pill. Without it the component paints only the one-pixel separator while retaining its wider hit strip.