position

package
v0.0.0-...-bbf78bc Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AxialPosition

type AxialPosition interface {
	// Find returns the mapped encapsulated position on the given interval
	Find(min, max int) int
}

AxialPosition is in interface used to map an abstract value to a concrete value for an axial position

type FixedPosition

type FixedPosition struct {
	// contains filtered or unexported fields
}

FixedPosition is an implementation for AxialPosition that calculates a fixed position with an offset

func Fixed

func Fixed(offset int) *FixedPosition

Fixed returns a FixedPosition with the given offset and reversed flag set to false

func (*FixedPosition) Find

func (pos *FixedPosition) Find(min, max int) int

Find returns the mapped position on the given interval based on offset if reversed flag is set to false or negative offset otherwise

func (*FixedPosition) Offset

func (pos *FixedPosition) Offset(offset int) *FixedPosition

Offset sets the offset to the given value

func (*FixedPosition) Reverse

func (pos *FixedPosition) Reverse(reversed bool) *FixedPosition

Reverse sets the reversed flag to the given value

type MixedPosition

type MixedPosition struct {
	// contains filtered or unexported fields
}

MixedPosition is an implementation of the Position interface that can encapsulates a different method of mapping for each axis

func Pos

func Pos(posX, posY AxialPosition) *MixedPosition

Pos returns a MixedPosition from the given AxialPositions

func (*MixedPosition) Find

func (pos *MixedPosition) Find(bounds image.Rectangle) image.Point

type PercentPosition

type PercentPosition struct {
	// contains filtered or unexported fields
}

PercentPosition is an implementation for AxialPosition that calculates a fixed position with an offset

func Percent

func Percent(percent float64) *PercentPosition

Percent returns a PercentPosition with the given percent and reversed flag set to false

func (*PercentPosition) Find

func (pos *PercentPosition) Find(min, max int) int

Find returns the mapped position on the given interval based on percent if reversed flag is false or negative percent otherwise

func (*PercentPosition) Percent

func (pos *PercentPosition) Percent(percent float64) *PercentPosition

Percent sets the percent to the given value

func (*PercentPosition) Reverse

func (pos *PercentPosition) Reverse(reversed bool) *PercentPosition

Reverse sets the reversed flag to the given value

type Position

type Position interface {
	Find(image.Rectangle) image.Point
}

Position is an interface for an abstract point that can be mapped to a image.Point of a image.Rectangle

Jump to

Keyboard shortcuts

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