geom

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package geom defines the geometric value types used throughout the Kite layout engine. All coordinates and extents are expressed in terminal cells (integer grid positions).

Types

  • Point: a position (X, Y) in terminal-cell coordinates.
  • Size: a two-dimensional extent (width × height).
  • Rect: an axis-aligned rectangle defined by an origin and a size. Methods include Contains, Inset, Intersect, and Overlaps.

Edges

Edges represents four-side inset values used by layout to compute padding, margin, and border boxes.

Placement

Placement enumerates the four cardinal positions relative to an anchor, used by the overlay system to decide flip direction.

Example:

rect := geom.Rect{
    Origin: geom.Point{X: 0, Y: 0},
    Size:   geom.Size{Width: 80, Height: 24},
}
content := rect.Inset(geom.Edges{Top: 1, Bottom: 1, Left: 2, Right: 2})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edges

type Edges struct {
	Top    int
	Right  int
	Bottom int
	Left   int
}

type Placement

type Placement int
const (
	PlacementTop Placement = iota
	PlacementBottom
	PlacementLeft
	PlacementRight
)

type Point

type Point struct {
	X, Y int
}

Point is a position in terminal-cell coordinates.

type Rect

type Rect struct {
	Origin Point
	Size   Size
}

Rect is an axis-aligned rectangle defined by an origin and a size, measured in terminal cells. All layout arithmetic uses integer cells (border-box).

func (Rect) Contains

func (r Rect) Contains(p Point) bool

Contains reports whether p lies inside r. The left/top edges are inclusive; the right/bottom edges are exclusive.

func (Rect) Inset

func (r Rect) Inset(e Edges) Rect

Inset returns a new Rect shrunk on all four sides by e. Width and Height are clamped to zero if the insets exceed the available space.

func (Rect) Intersect

func (r Rect) Intersect(other Rect) Rect

Intersect returns the largest Rect contained in both r and other. If the rectangles do not overlap, a zero Rect is returned.

func (Rect) Overlaps

func (r Rect) Overlaps(other Rect) bool

Overlaps reports whether r and other have a non-empty intersection.

type Size

type Size struct {
	Width  int
	Height int
}

Size represents a two-dimensional extent (width × height) in terminal cells.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL