From e71fde8c4e9d2be9e19821c84504721721eae05b Mon Sep 17 00:00:00 2001 From: msiglreith Date: Thu, 26 Nov 2015 15:20:07 +0100 Subject: [PATCH] display selected color in toolbar and improve pipette workflow (switch back to edit mode on right-click) --- src/game/editor/editor.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 3756cec06..41a3368be 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -1110,7 +1110,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Bottom.VSplitLeft(10.0f, 0, &TB_Bottom); // pipette / color picking - TB_Bottom.VSplitLeft(40.0f, &Button, &TB_Bottom); + TB_Bottom.VSplitLeft(50.0f, &Button, &TB_Bottom); static int s_ColorPickingButton = 0; if(DoButton_Editor(&s_ColorPickingButton, "Pipette", m_MouseEdMode == MOUSE_PIPETTE, &Button, 0, "Pick color from view")) { @@ -1121,6 +1121,15 @@ void CEditor::DoToolbar(CUIRect ToolBar) m_MouseEdMode = MOUSE_PIPETTE; } + // display selected color + if(m_SelectedColor.a > 0.0f) + { + TB_Bottom.VSplitLeft(4.0f, 0, &TB_Bottom); + + TB_Bottom.VSplitLeft(24.0f, &Button, &TB_Bottom); + RenderTools()->DrawUIRect(&Button, m_SelectedColor, 0, 0.0f); + } + } static void Rotate(const CPoint *pCenter, CPoint *pPoint, float Rotation) @@ -2144,7 +2153,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } break; case MOUSE_PIPETTE: - { + { if(UI()->HotItem() == s_pEditorID) { m_pTooltip = "Use left mouse button to pick a color from screen."; @@ -2176,6 +2185,11 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) } } } + + // leave pipette mode on right-click + if(UI()->MouseButton(1)) + m_MouseEdMode = MOUSE_EDIT; + } break; }