mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Add quick action "Pipette"
This commit is contained in:
parent
157498799e
commit
44fc871463
|
@ -1228,10 +1228,10 @@ void CEditor::DoToolbarLayers(CUIRect ToolBar)
|
|||
static char s_PipetteButton;
|
||||
ColorPalette.VSplitLeft(PipetteButtonWidth, &Button, &ColorPalette);
|
||||
ColorPalette.VSplitLeft(Spacing, nullptr, &ColorPalette);
|
||||
if(DoButton_FontIcon(&s_PipetteButton, FONT_ICON_EYE_DROPPER, m_ColorPipetteActive ? 1 : 0, &Button, 0, "[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.", IGraphics::CORNER_ALL) ||
|
||||
if(DoButton_FontIcon(&s_PipetteButton, FONT_ICON_EYE_DROPPER, m_QuickActionPipette.Active(), &Button, 0, m_QuickActionPipette.Description(), IGraphics::CORNER_ALL) ||
|
||||
(CLineInput::GetActiveInput() == nullptr && ModPressed && ShiftPressed && Input()->KeyPress(KEY_C)))
|
||||
{
|
||||
m_ColorPipetteActive = !m_ColorPipetteActive;
|
||||
m_QuickActionPipette.Call();
|
||||
}
|
||||
|
||||
// Palette color pickers
|
||||
|
|
|
@ -228,6 +228,14 @@ REGISTER_QUICK_ACTION(
|
|||
[&]() -> bool { return m_ShowTileInfo == SHOW_TILE_HEXADECIMAL; },
|
||||
DEFAULT_BTN,
|
||||
"[Ctrl+Shift+I] Show tile information in hexadecimal.")
|
||||
REGISTER_QUICK_ACTION(
|
||||
Pipette,
|
||||
"Pipette",
|
||||
[&]() { m_ColorPipetteActive = !m_ColorPipetteActive; },
|
||||
ALWAYS_FALSE,
|
||||
[&]() -> bool { return m_ColorPipetteActive; },
|
||||
DEFAULT_BTN,
|
||||
"[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.")
|
||||
|
||||
#undef ALWAYS_FALSE
|
||||
#undef DEFAULT_BTN
|
||||
|
|
Loading…
Reference in a new issue