Documentation ¶
Overview ¶
Package relpos defines a position relationship among layers, in terms of X,Y width and height of layer and associated position within a given X-Y plane, and Z vertical stacking of layers above and below each other.
Index ¶
- type Pos
- func (rp *Pos) AlignXPos(xop, xosz, xsz float32) float32
- func (rp *Pos) AlignYPos(yop, yosz, ysz float32) float32
- func (rp *Pos) Defaults()
- func (rp *Pos) SetAbove(other string)
- func (rp *Pos) SetBehind(other string, space float32)
- func (rp *Pos) SetPos(op math32.Vector3, osz math32.Vector2, sz math32.Vector2)
- func (rp *Pos) SetRightOf(other string, space float32)
- func (rp *Pos) ShouldDisplay(field string) bool
- type Relations
- func (i Relations) Desc() string
- func (i Relations) Int64() int64
- func (i Relations) MarshalText() ([]byte, error)
- func (i *Relations) SetInt64(in int64)
- func (i *Relations) SetString(s string) error
- func (i Relations) String() string
- func (i *Relations) UnmarshalText(text []byte) error
- func (i Relations) Values() []enums.Enum
- type XAligns
- func (i XAligns) Desc() string
- func (i XAligns) Int64() int64
- func (i XAligns) MarshalText() ([]byte, error)
- func (i *XAligns) SetInt64(in int64)
- func (i *XAligns) SetString(s string) error
- func (i XAligns) String() string
- func (i *XAligns) UnmarshalText(text []byte) error
- func (i XAligns) Values() []enums.Enum
- type YAligns
- func (i YAligns) Desc() string
- func (i YAligns) Int64() int64
- func (i YAligns) MarshalText() ([]byte, error)
- func (i *YAligns) SetInt64(in int64)
- func (i *YAligns) SetString(s string) error
- func (i YAligns) String() string
- func (i *YAligns) UnmarshalText(text []byte) error
- func (i YAligns) Values() []enums.Enum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pos ¶
type Pos struct { // spatial relationship between this layer and the other layer Rel Relations // ] horizontal (x-axis) alignment relative to other XAlign XAligns // ] vertical (y-axis) alignment relative to other YAlign YAligns // name of the other layer we are in relationship to Other string // scaling factor applied to layer size for displaying Scale float32 // number of unit-spaces between us Space float32 // for vertical (y-axis) alignment, amount we are offset relative to perfect alignment XOffset float32 // for horizontial (x-axis) alignment, amount we are offset relative to perfect alignment YOffset float32 // Pos is the computed position of lower-left-hand corner of layer // in 3D space, computed from the relation to other layer. Pos math32.Vector3 `edit:"-"` }
Pos specifies the relative spatial relationship to another layer, which determines positioning. Every layer except one "anchor" layer should be positioned relative to another, e.g., RightOf, Above, etc. This provides robust positioning in the face of layer size changes etc. Layers are arranged in X-Y planes, stacked vertically along the Z axis.
func (*Pos) AlignXPos ¶
AlignXPos returns the X-axis (within-plane horizontal or width) position according to alignment factors.
func (*Pos) AlignYPos ¶
AlignYPos returns the Y-axis (within-plane vertical or height) position according to alignment factors.
func (*Pos) Defaults ¶
func (rp *Pos) Defaults()
Defaults sets default scale, space, offset values. The relationship and align must be set specifically. These are automatically applied if Scale = 0
func (*Pos) SetAbove ¶
SetAbove returns an Above relationship with default XAlign: Left, YAlign: Front alignment
func (*Pos) SetBehind ¶
SetBehind sets a Behind relationship with default XAlign: Left alignment and given spacing.
func (*Pos) SetPos ¶
SetPos sets the relative position based on other layer position and size, using current settings. osz and sz must both have already been scaled by relevant Scale factor.
func (*Pos) SetRightOf ¶
SetRightOf sets a RightOf relationship with default YAlign: Front alignment and given spacing.
func (*Pos) ShouldDisplay ¶
type Relations ¶
type Relations int32 //enums:enum
Relations are different spatial relationships (of layers)
const RelationsN Relations = 7
RelationsN is the highest valid value for type Relations, plus one.
func RelationsValues ¶
func RelationsValues() []Relations
RelationsValues returns all possible values for the type Relations.
func (Relations) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Relations) SetString ¶
SetString sets the Relations value from its string representation, and returns an error if the string is invalid.
func (*Relations) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type XAligns ¶
type XAligns int32 //enums:enum
XAligns are different horizontal alignments
const XAlignsN XAligns = 3
XAlignsN is the highest valid value for type XAligns, plus one.
func XAlignsValues ¶
func XAlignsValues() []XAligns
XAlignsValues returns all possible values for the type XAligns.
func (XAligns) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*XAligns) SetString ¶
SetString sets the XAligns value from its string representation, and returns an error if the string is invalid.
func (*XAligns) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type YAligns ¶
type YAligns int32 //enums:enum
YAligns are different vertical alignments
const YAlignsN YAligns = 3
YAlignsN is the highest valid value for type YAligns, plus one.
func YAlignsValues ¶
func YAlignsValues() []YAligns
YAlignsValues returns all possible values for the type YAligns.
func (YAligns) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*YAligns) SetString ¶
SetString sets the YAligns value from its string representation, and returns an error if the string is invalid.
func (*YAligns) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.