Merge pull request #8883 from ChillerDragon/pr_actions_zoom

Add quick actions for zooming the view
This commit is contained in:
Dennis Felsing 2024-09-03 07:02:15 +00:00 committed by GitHub
commit 41c40fb27f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 6 deletions

View file

@ -1121,23 +1121,23 @@ void CEditor::DoToolbarLayers(CUIRect ToolBar)
// zoom group
TB_Top.VSplitLeft(20.0f, &Button, &TB_Top);
static int s_ZoomOutButton = 0;
if(DoButton_FontIcon(&s_ZoomOutButton, FONT_ICON_MINUS, 0, &Button, 0, "[NumPad-] Zoom out", IGraphics::CORNER_L))
if(DoButton_FontIcon(&s_ZoomOutButton, FONT_ICON_MINUS, 0, &Button, 0, m_QuickActionZoomOut.Description(), IGraphics::CORNER_L))
{
MapView()->Zoom()->ChangeValue(50.0f);
m_QuickActionZoomOut.Call();
}
TB_Top.VSplitLeft(25.0f, &Button, &TB_Top);
static int s_ZoomNormalButton = 0;
if(DoButton_FontIcon(&s_ZoomNormalButton, FONT_ICON_MAGNIFYING_GLASS, 0, &Button, 0, "[NumPad*] Zoom to normal and remove editor offset", IGraphics::CORNER_NONE))
if(DoButton_FontIcon(&s_ZoomNormalButton, FONT_ICON_MAGNIFYING_GLASS, 0, &Button, 0, m_QuickActionResetZoom.Description(), IGraphics::CORNER_NONE))
{
MapView()->ResetZoom();
m_QuickActionResetZoom.Call();
}
TB_Top.VSplitLeft(20.0f, &Button, &TB_Top);
static int s_ZoomInButton = 0;
if(DoButton_FontIcon(&s_ZoomInButton, FONT_ICON_PLUS, 0, &Button, 0, "[NumPad+] Zoom in", IGraphics::CORNER_R))
if(DoButton_FontIcon(&s_ZoomInButton, FONT_ICON_PLUS, 0, &Button, 0, m_QuickActionZoomIn.Description(), IGraphics::CORNER_R))
{
MapView()->Zoom()->ChangeValue(-50.0f);
m_QuickActionZoomIn.Call();
}
TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top);

View file

@ -127,6 +127,30 @@ REGISTER_QUICK_ACTION(
ALWAYS_FALSE,
DEFAULT_BTN,
"Adds a new group.")
REGISTER_QUICK_ACTION(
ResetZoom,
"Reset Zoom",
[&]() { MapView()->ResetZoom(); },
ALWAYS_FALSE,
ALWAYS_FALSE,
DEFAULT_BTN,
"[Numpad*] Zoom to normal and remove editor offset.")
REGISTER_QUICK_ACTION(
ZoomOut,
"Zoom Out",
[&]() { MapView()->Zoom()->ChangeValue(50.0f); },
ALWAYS_FALSE,
ALWAYS_FALSE,
DEFAULT_BTN,
"[Numpad-] Zoom out.")
REGISTER_QUICK_ACTION(
ZoomIn,
"Zoom In",
[&]() { MapView()->Zoom()->ChangeValue(-50.0f); },
ALWAYS_FALSE,
ALWAYS_FALSE,
DEFAULT_BTN,
"[Numpad+] Zoom in.")
REGISTER_QUICK_ACTION(
Refocus,
"Refocus",