1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crate::material::AlignmentGeometry;
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Alignment {
pub x: f32,
pub y: f32,
}
impl Alignment {
// The center point along the bottom edge.
pub const BOTTOM_CENTER: Alignment = Alignment { x: 0.0, y: 1.0 };
// The bottom left corner.
pub const BOTTOM_LEFT: Alignment = Alignment { x: -1.0, y: 1.0 };
// The bottom right corner.
pub const BOTTOM_RIGHT: Alignment = Alignment { x: 1.0, y: 1.0 };
// The center point, both horizontally and vertically.
pub const CENTER: Alignment = Alignment { x: 0.0, y: 0.0 };
// The center point along the left edge.
pub const CENTER_LEFT: Alignment = Alignment { x: -1.0, y: 0.0 };
// The center point along the right edge.
pub const CENTER_RIGHT: Alignment = Alignment { x: 1.0, y: 0.0 };
// The center point along the top edge.
pub const TOP_CENTER: Alignment = Alignment { x: 0.0, y: -1.0 };
// The top left corner.
pub const TOP_LEFT: Alignment = Alignment { x: -1.0, y: -1.0 };
// The top right corner.
pub const TOP_RIGHT: Alignment = Alignment { x: 1.0, y: -1.0 };
// add(AlignmentGeometry other) → AlignmentGeometry
// Returns the sum of two AlignmentGeometry objects.
// override
// alongOffset(Offset other) → Offset
// Returns the offset that is this fraction in the direction of the given offset.
// alongSize(Size other) → Offset
// Returns the offset that is this fraction within the given size.
// inscribe(Size size, Rect rect) → Rect
// Returns a rect of the given size, aligned within given rect as specified by this alignment.
// noSuchMethod(Invocation invocation) → dynamic
// Invoked when a non-existent method or property is accessed.
// inherited
// resolve(TextDirection? direction) → Alignment
// Convert this instance into an Alignment, which uses literal coordinates (the x coordinate being explicitly a distance from the left).
// override
// toString() → String
// A string representation of this object.
// override
// withinRect(Rect rect) → Offset
// Returns the point that is this fraction within the given rect.
}
impl AlignmentGeometry for Alignment {}