Documentation ¶
Index ¶
- Constants
- func Draw(travCtx TraversalContext, root interface{}, ctx *Context2D)
- func Edit(base string, keycode string, key string) string
- func IsVecOutside(vec, size vec2.Vec2) bool
- func NoopExit(WidgetPath)
- func PickOption(options []OptionContext, keycode string, key string) (WidgetPath, Option)
- func ToLocal(m TextMeasurer, path WidgetPath, v vec2.Vec2) vec2.Vec2
- func Walk(start interface{}, enter EnterCallback, exit ExitCallback)
- func WalkAtPoint(m TextMeasurer, start interface{}, point vec2.Vec2, ...)
- type Action
- type Box
- type Context2D
- func (ctx *Context2D) Arc(x, y, r, alpha, beta float64, anticlockwise bool)
- func (ctx *Context2D) Arrow(size float64)
- func (ctx *Context2D) BeginPath()
- func (ctx *Context2D) Circle(pos vec2.Vec2, radius float64)
- func (ctx *Context2D) Clip()
- func (ctx *Context2D) ClosePath()
- func (ctx *Context2D) Ellipse(x, y, rx, ry, rotation, alpha, beta float64, anticlockwise bool)
- func (ctx *Context2D) Fill()
- func (ctx *Context2D) FillRect(x, y, w, h float64)
- func (ctx *Context2D) FillStyle(fill string)
- func (ctx *Context2D) FillText(text string, x, y float64)
- func (ctx *Context2D) Font(font string)
- func (ctx *Context2D) Hourglass(color string)
- func (ctx *Context2D) LineTo(x, y float64)
- func (ctx *Context2D) LineTo2(pos vec2.Vec2)
- func (ctx *Context2D) LineWidth(w float64)
- func (ctx *Context2D) MarshalJSON() ([]byte, error)
- func (ctx *Context2D) MeasureText(text string) float64
- func (ctx *Context2D) MoveTo(x, y float64)
- func (ctx *Context2D) MoveTo2(pos vec2.Vec2)
- func (ctx *Context2D) Rect(x, y, w, h float64)
- func (ctx *Context2D) Rect2(box Box)
- func (ctx *Context2D) Restore()
- func (ctx *Context2D) Rotate(alpha float64)
- func (ctx *Context2D) Save()
- func (ctx *Context2D) Scale(s float64)
- func (ctx *Context2D) SetLineDash(pattern []float64)
- func (ctx *Context2D) Stroke()
- func (ctx *Context2D) StrokeStyle(style string)
- func (ctx *Context2D) TextAlign(align string)
- func (ctx *Context2D) TextBaseline(baseline string)
- func (ctx *Context2D) Transform(m matrix.Matrix)
- func (ctx *Context2D) Translate(x, y float64)
- func (ctx *Context2D) Translate2(pos vec2.Vec2)
- type Drawable
- type EditOption
- type EditStatus
- type Editable
- type EnterCallback
- type ExitCallback
- type Menu
- type MenuLayer
- type MenuRoot
- type Option
- type OptionContext
- type Parent
- type PostDrawable
- type PreMoveAction
- type Sized
- type Spring
- type TextMeasurer
- type Touch
- func (t *Touch) EndAction(m TextMeasurer)
- func (t *Touch) Move(m TextMeasurer, curr vec2.Vec2)
- func (t *Touch) OpenMenu(queryCtx TraversalContext, root MenuRoot)
- func (t *Touch) Position(m TextMeasurer, w interface{}) vec2.Vec2
- func (t *Touch) StartAction(queryCtx TraversalContext, root interface{}, keycode string, key string)
- type TouchContext
- type Transformed
- type TraversalContext
- type TypeOption
- type WalkAction
- type Widget
- type WidgetPath
Constants ¶
View Source
const Tau = math.Pi * 2
Variables ¶
This section is empty.
Functions ¶
func Draw ¶
func Draw(travCtx TraversalContext, root interface{}, ctx *Context2D)
func IsVecOutside ¶
func NoopExit ¶
func NoopExit(WidgetPath)
func PickOption ¶
func PickOption(options []OptionContext, keycode string, key string) (WidgetPath, Option)
func ToLocal ¶
func ToLocal(m TextMeasurer, path WidgetPath, v vec2.Vec2) vec2.Vec2
func Walk ¶
func Walk(start interface{}, enter EnterCallback, exit ExitCallback)
func WalkAtPoint ¶
func WalkAtPoint(m TextMeasurer, start interface{}, point vec2.Vec2, callback func(WidgetPath, vec2.Vec2) WalkAction)
Types ¶
type Action ¶
type Action interface { Move(TouchContext) Action End(TouchContext) }
type Context2D ¶
type Context2D struct {
// contains filtered or unexported fields
}
func MakeContext2D ¶
func MakeContext2D(m TextMeasurer) Context2D
func (*Context2D) MarshalJSON ¶
func (*Context2D) MeasureText ¶
func (*Context2D) SetLineDash ¶
func (*Context2D) StrokeStyle ¶
func (*Context2D) TextBaseline ¶
func (*Context2D) Translate2 ¶
type EditOption ¶
type EditOption struct { EditStatus EditStatus Editable Editable }
func (EditOption) Activate ¶
func (o EditOption) Activate(TouchContext) Action
func (EditOption) IsEditing ¶
func (o EditOption) IsEditing() bool
func (EditOption) Keycode ¶
func (EditOption) Keycode() string
func (EditOption) Name ¶
func (EditOption) Name() string
type EditStatus ¶
type EnterCallback ¶
type EnterCallback func(WidgetPath) WalkAction
type ExitCallback ¶
type ExitCallback func(WidgetPath)
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
func (*Menu) ChooseOption ¶
func (*Menu) End ¶
func (m *Menu) End(ctx TouchContext)
func (*Menu) LoopOptions ¶
alpha ∈ [0,Tau); beta > alpha
func (*Menu) Move ¶
func (m *Menu) Move(ctx TouchContext) Action
type MenuLayer ¶
type MenuLayer struct {
// contains filtered or unexported fields
}
func MakeMenuLayer ¶
func MakeMenuLayer() MenuLayer
func (*MenuLayer) OpenMenu ¶
func (l *MenuLayer) OpenMenu(ctx TouchContext, opts []OptionContext) *Menu
type Option ¶
type Option interface { Name() string Keycode() string Activate(TouchContext) Action }
type OptionContext ¶
type OptionContext struct { Path WidgetPath Options []Option }
func QueryOptions ¶
func QueryOptions(travCtx TraversalContext, root interface{}, v vec2.Vec2) []OptionContext
type PostDrawable ¶
type PostDrawable interface {
PostDraw(*Context2D)
}
type PreMoveAction ¶
type PreMoveAction interface {
PreMove(TouchContext)
}
type Sized ¶
type Sized interface {
Size(TextMeasurer) Box
}
type TextMeasurer ¶
type Touch ¶
type Touch struct { Curr vec2.Vec2 Last vec2.Vec2 Wheel float64 // contains filtered or unexported fields }
func (*Touch) EndAction ¶
func (t *Touch) EndAction(m TextMeasurer)
func (*Touch) OpenMenu ¶
func (t *Touch) OpenMenu(queryCtx TraversalContext, root MenuRoot)
func (*Touch) StartAction ¶
func (t *Touch) StartAction(queryCtx TraversalContext, root interface{}, keycode string, key string)
type TouchContext ¶
type TouchContext struct { Touch *Touch Path WidgetPath // contains filtered or unexported fields }
func (TouchContext) At ¶
func (ctx TouchContext) At(check func(interface{}) bool) TouchContext
func (TouchContext) AtTopBlueprint ¶
func (ctx TouchContext) AtTopBlueprint() TouchContext
func (TouchContext) Delta ¶
func (ctx TouchContext) Delta() vec2.Vec2
func (TouchContext) Position ¶
func (ctx TouchContext) Position() vec2.Vec2
func (TouchContext) Query ¶
func (ctx TouchContext) Query(callback func(WidgetPath, vec2.Vec2) WalkAction)
type Transformed ¶
type Transformed interface {
Transform(TextMeasurer) matrix.Matrix
}
type TraversalContext ¶
type TraversalContext interface { TextMeasurer EditStatus }
type TypeOption ¶
type TypeOption struct { Editable Editable // contains filtered or unexported fields }
func (TypeOption) Activate ¶
func (t TypeOption) Activate(TouchContext) Action
func (TypeOption) Keycode ¶
func (TypeOption) Keycode() string
func (TypeOption) Name ¶
func (TypeOption) Name() string
type WalkAction ¶
type WalkAction int
const ( Explore WalkAction = iota Avoid Return )
func WalkWithin ¶
func WalkWithin(path WidgetPath, enter EnterCallback, exit ExitCallback) WalkAction
type WidgetPath ¶
type WidgetPath []interface{} // root-to-child
Click to show internal directories.
Click to hide internal directories.