pub struct Placement {
pub fit: Fit,
pub align: Align,
pub frame: Option<Rect>,
pub offset: (f32, f32),
pub scale: f32,
pub flip_x: bool,
pub flip_y: bool,
pub rotation: f32,
}Expand description
Everything that places an animation inside a view.
The defaults are contain, centred, unscaled, unflipped, unrotated — so
Placement::default() is “make it fit and put it in the middle”, which is
what a host reaching for this wants nine times out of ten.
Fields§
§fit: Fit§align: Align§frame: Option<Rect>The box to fit, in player-local units. Supply it and nothing is
measured — SSPlayer::fit_into otherwise
falls back to the authored canvas
(SSPlayer::canvas_rect).
offset: (f32, f32)Pixels from the aligned position, applied after the fit, so it is not scaled by it.
scale: f32A multiplier on top of the fit’s scale, not a replacement for it.
flip_x: boolMirror horizontally. A flip is a negative scale on that axis, and the alignment follows it — a left-aligned mirrored character still sits against the left edge.
flip_y: boolMirror vertically.
rotation: f32Passed through to SSPlayer::set_transform
untouched. Rotation has no part in the fit contract; it is here so that
fitting does not silently discard the rotation a caller already had.