mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Add quick actions for zooming the view
This commit is contained in:
parent
1cbdb9d2f0
commit
d0eebee44d
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue