mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Added an option in the ContextBar to reset the symmetry options to the current view center.
This commit is contained in:
parent
ec42689b82
commit
d4c9a2fb36
@ -1857,4 +1857,5 @@ toggle = Toggle Symmetry
|
||||
toggle_horizontal = Toggle Horizontal Symmetry
|
||||
toggle_vertical = Toggle Vertical Symmetry
|
||||
show_options = Symmetry Options
|
||||
reset_position = Reset Symmetry to Center
|
||||
reset_position_to_center = Reset Symmetry to Center
|
||||
reset_position_to_view_center = Reset Symmetry to View Center
|
||||
|
@ -1575,11 +1575,13 @@ private:
|
||||
item->setSelected(false);
|
||||
|
||||
Menu menu;
|
||||
MenuItem
|
||||
reset(Strings::symmetry_reset_position());
|
||||
menu.addChild(&reset);
|
||||
MenuItem resetToCenter(Strings::symmetry_reset_position_to_center());
|
||||
MenuItem resetToViewCenter(Strings::symmetry_reset_position_to_view_center());
|
||||
|
||||
reset.Click.connect(
|
||||
menu.addChild(&resetToCenter);
|
||||
menu.addChild(&resetToViewCenter);
|
||||
|
||||
resetToCenter.Click.connect(
|
||||
[doc, &docPref]{
|
||||
docPref.symmetry.xAxis(doc->sprite()->width()/2.0);
|
||||
docPref.symmetry.yAxis(doc->sprite()->height()/2.0);
|
||||
@ -1587,6 +1589,18 @@ private:
|
||||
doc->notifyGeneralUpdate();
|
||||
});
|
||||
|
||||
resetToViewCenter.Click.connect(
|
||||
[doc, &docPref]{
|
||||
auto* editor = Editor::activeEditor();
|
||||
const gfx::Rect& bounds = editor->getViewportBounds();
|
||||
double xViewPosition = bounds.x + bounds.w/2.0;
|
||||
double yViewPosition = bounds.y + bounds.h/2.0;
|
||||
docPref.symmetry.xAxis(xViewPosition);
|
||||
docPref.symmetry.yAxis(yViewPosition);
|
||||
// Redraw symmetry rules
|
||||
doc->notifyGeneralUpdate();
|
||||
});
|
||||
|
||||
menu.showPopup(gfx::Point(bounds.x, bounds.y2()),
|
||||
display());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user