Documentation ¶
Overview ¶
Package zoom contains code that tracks the current zoom level.
Index ¶
Constants ¶
const DefaultScrollStep = 10
DefaultScrollStep is the default value for the ScrollStep option.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options.
func ScrollStep ¶
ScrollStep sets the amount of zoom in or out on a single mouse scroll event. This is set as a percentage of the current value size of the X axis. Must be a value in range 0 < value <= 100. Defaults to DefaultScrollStep.
type Range ¶
type Range struct { // Start is the start of the range. Start int // End is the end of the range. End int // contains filtered or unexported fields }
Range represents a range of values. The range includes all values x such that Start <= x < End.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker tracks the state of mouse selection on the linechart and stores requests for zoom. This object is not thread-safe.
func New ¶
New returns a new zoom tracker that tracks zoom requests within the provided graph area. The cvsAr argument indicates size of the entire canvas available to the widget.
func (*Tracker) Highlight ¶
Highlight returns true if a range on the graph area should be highlighted because the user is holding down the left mouse button and dragging mouse across the graph area. The returned range indicates the range of X cell coordinates within the graph area provided to New or Update. These are the columns that should be highlighted. Returns false of no area should be highlighted, in which case the state of the Range return value is undefined.
func (*Tracker) Mouse ¶
func (t *Tracker) Mouse(m *terminalapi.Mouse) error
Mouse is used to forward mouse events to the zoom tracker.