Skip to main content

Glyph.Positioning

A class in Root.Township, Alta.Pages.

Where a glyph sits on a page: position, rotation and scale, snapped to steps so it syncs compactly (0.01 position, 10 degrees, 0.1 scale).

Constructors​

MemberWhat it is
Positioning()Creates a Glyph.Positioning from glyph, position, rotation and scale.
Positioning(Glyph glyph, Vector2 position, float rotation, float scale)Creates a Glyph.Positioning from glyph, position, rotation and scale.

Fields​

4 private and internal fields
MemberWhat it is
private Glyph glyphBacking field for Glyph, the glyph placed.
private Vector2 positionBacking field for Position, where the glyph sits on the page. Defaults to (0.5, 0.75).
private float rotationBacking field for Rotation.
private float scaleBacking field for Scale (1 by default).

Properties​

MemberWhat it is
Glyph Glyph { get; }The glyph drawn.
Vector2 Position { get; }Position on the page: x from 0 to 1, y from 0 to the page's size ratio.
float Rotation { get; }Rotation in degrees, 0 to 350.
float Scale { get; }Scale, from 0.25 to 4.5.

Methods​

MemberWhat it is
void ApplyTo(Transform transform)Places a transform on the page from this positioning.
void CalculateFrom(Transform transform)Reads a transform's place on the page, snaps it to the steps, clamps it and moves the transform to match.
Glyph.Positioning Copy()Returns a copy.
override int GetHashCode()Hash of the snapped values and the glyph's hash.
void Serialize(Stream stream)Reads or writes the glyph hash and snapped values.
void Validate()Clamps position, rotation and scale to their ranges.

Used in​

Members of other types that take, return or hold a Positioning: