mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Merge pull request #8883 from ChillerDragon/pr_actions_zoom
Add quick actions for zooming the view
This commit is contained in:
commit
41c40fb27f
|
@ -1121,23 +1121,23 @@ void CEditor::DoToolbarLayers(CUIRect ToolBar)
|
||||||
// zoom group
|
// zoom group
|
||||||
TB_Top.VSplitLeft(20.0f, &Button, &TB_Top);
|
TB_Top.VSplitLeft(20.0f, &Button, &TB_Top);
|
||||||
static int s_ZoomOutButton = 0;
|
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);
|
TB_Top.VSplitLeft(25.0f, &Button, &TB_Top);
|
||||||
static int s_ZoomNormalButton = 0;
|
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);
|
TB_Top.VSplitLeft(20.0f, &Button, &TB_Top);
|
||||||
static int s_ZoomInButton = 0;
|
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);
|
TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top);
|
||||||
|
|
|
@ -127,6 +127,30 @@ REGISTER_QUICK_ACTION(
|
||||||
ALWAYS_FALSE,
|
ALWAYS_FALSE,
|
||||||
DEFAULT_BTN,
|
DEFAULT_BTN,
|
||||||
"Adds a new group.")
|
"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(
|
REGISTER_QUICK_ACTION(
|
||||||
Refocus,
|
Refocus,
|
||||||
"Refocus",
|
"Refocus",
|
||||||
|
|
Loading…
Reference in a new issue