Correct horizontal and vertical centering icon actions
This commit is contained in:
parent
8dffb43379
commit
a3012f34c8
|
|
@ -882,8 +882,8 @@ impl Editor {
|
|||
(0, 2, "Align bottom left", Some(Left), Some(Bottom)),
|
||||
(1, 2, "Align bottom", None, Some(Bottom)),
|
||||
(2, 2, "Align bottom right", Some(Right), Some(Bottom)),
|
||||
(3, 0, "Center vertically", None, Some(VerticalCenter)),
|
||||
(3, 2, "Center horizontally", Some(HorizontalCenter), None),
|
||||
(3, 0, "Center horizontally", Some(HorizontalCenter), None),
|
||||
(3, 2, "Center vertically", None, Some(VerticalCenter)),
|
||||
] {
|
||||
let rect = Rect::from_min_size(
|
||||
grid.min + Vec2::new(col as f32 * 44.0, row as f32 * 44.0),
|
||||
|
|
@ -1719,6 +1719,12 @@ fn alignment_icon(
|
|||
Some(Alignment::Bottom) => 6.0,
|
||||
_ => 0.0,
|
||||
};
|
||||
// The standalone centering icons indicate the direction of movement.
|
||||
let (horizontal, vertical) = match (horizontal, vertical) {
|
||||
(Some(Alignment::HorizontalCenter), None) => (None, Some(Alignment::VerticalCenter)),
|
||||
(None, Some(Alignment::VerticalCenter)) => (Some(Alignment::HorizontalCenter), None),
|
||||
axes => axes,
|
||||
};
|
||||
for (axis, value) in [(0, horizontal), (1, vertical)] {
|
||||
if let Some(value) = value {
|
||||
let offset = match value {
|
||||
|
|
@ -2712,8 +2718,8 @@ mod tests {
|
|||
(6, Some(0.0), Some(1080.0)),
|
||||
(7, None, Some(1080.0)),
|
||||
(8, Some(1920.0), Some(1080.0)),
|
||||
(9, None, Some(540.0)),
|
||||
(10, Some(960.0), None),
|
||||
(9, Some(960.0), None),
|
||||
(10, None, Some(540.0)),
|
||||
] {
|
||||
let mut app = Editor::default();
|
||||
app.layout.set_output([2560, 1440]).unwrap();
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ An explicitly chosen reference layer takes precedence, stays fixed and does not
|
|||
need to be selected. There is no separate Screen option for multi-selection.
|
||||
|
||||
The compact icon grid offers four corners, top/bottom/left/right edges, center
|
||||
on both axes, and separate horizontal/vertical centering. Edge buttons change
|
||||
on both axes, and separate horizontal/vertical centering. The top-right button
|
||||
centers horizontally (X); the bottom-right button centers vertically (Y). Edge buttons change
|
||||
only their axis; corner buttons change both axes. Hover an icon for its label.
|
||||
Every action preserves layer sizes and is one undo step, including corner moves.
|
||||
The menu also works with one selected layer and a different reference layer.
|
||||
|
|
|
|||
Loading…
Reference in New Issue