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_horizontal = Toggle Horizontal Symmetry
|
||||||
toggle_vertical = Toggle Vertical Symmetry
|
toggle_vertical = Toggle Vertical Symmetry
|
||||||
show_options = Symmetry Options
|
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);
|
item->setSelected(false);
|
||||||
|
|
||||||
Menu menu;
|
Menu menu;
|
||||||
MenuItem
|
MenuItem resetToCenter(Strings::symmetry_reset_position_to_center());
|
||||||
reset(Strings::symmetry_reset_position());
|
MenuItem resetToViewCenter(Strings::symmetry_reset_position_to_view_center());
|
||||||
menu.addChild(&reset);
|
|
||||||
|
|
||||||
reset.Click.connect(
|
menu.addChild(&resetToCenter);
|
||||||
|
menu.addChild(&resetToViewCenter);
|
||||||
|
|
||||||
|
resetToCenter.Click.connect(
|
||||||
[doc, &docPref]{
|
[doc, &docPref]{
|
||||||
docPref.symmetry.xAxis(doc->sprite()->width()/2.0);
|
docPref.symmetry.xAxis(doc->sprite()->width()/2.0);
|
||||||
docPref.symmetry.yAxis(doc->sprite()->height()/2.0);
|
docPref.symmetry.yAxis(doc->sprite()->height()/2.0);
|
||||||
@ -1587,6 +1589,18 @@ private:
|
|||||||
doc->notifyGeneralUpdate();
|
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()),
|
menu.showPopup(gfx::Point(bounds.x, bounds.y2()),
|
||||||
display());
|
display());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user