mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 20:25:57 +08:00
DoubleSlider Improvements:
Added color change on LeftMouseClick on "Plus"
This commit is contained in:
parent
5247ebe325
commit
7d2c0be4a7
@ -647,6 +647,8 @@ void DSForLayers::Render(const int canvas_width, const int canvas_height, float
|
|||||||
// discard all getters dialogs
|
// discard all getters dialogs
|
||||||
m_show_get_jump_value = false;
|
m_show_get_jump_value = false;
|
||||||
}
|
}
|
||||||
|
else if (m_ctrl.IsLClickOnThumb())
|
||||||
|
add_code_as_tick(ColorChange);
|
||||||
|
|
||||||
// draw action buttons
|
// draw action buttons
|
||||||
|
|
||||||
|
@ -515,6 +515,19 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos,
|
|||||||
context.IO.MouseClicked[0])
|
context.IO.MouseClicked[0])
|
||||||
m_rclick_on_selected_thumb = false;
|
m_rclick_on_selected_thumb = false;
|
||||||
|
|
||||||
|
// detect left click on selected thumb
|
||||||
|
if (ImGui::ItemHoverable(active_thumb, id) && !pos_changed) {
|
||||||
|
ImVec2 active_thumb_center = active_thumb.GetCenter();
|
||||||
|
if (context.IO.MouseClicked[0])
|
||||||
|
m_active_thumb_center_on_lcklick = active_thumb_center;
|
||||||
|
if (context.IO.MouseReleased[0] &&
|
||||||
|
(m_active_thumb_center_on_lcklick.y == active_thumb_center.y) &&
|
||||||
|
(m_active_thumb_center_on_lcklick.x == active_thumb_center.x) )
|
||||||
|
m_lclick_on_selected_thumb = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_lclick_on_selected_thumb = false;
|
||||||
|
|
||||||
// render slider
|
// render slider
|
||||||
|
|
||||||
ImVec2 higher_thumb_center = m_regions.higher_thumb.GetCenter();
|
ImVec2 higher_thumb_center = m_regions.higher_thumb.GetCenter();
|
||||||
|
@ -84,6 +84,7 @@ public:
|
|||||||
ImRect GetActiveThumbRect() const;
|
ImRect GetActiveThumbRect() const;
|
||||||
|
|
||||||
bool IsRClickOnThumb() const { return m_rclick_on_selected_thumb; }
|
bool IsRClickOnThumb() const { return m_rclick_on_selected_thumb; }
|
||||||
|
bool IsLClickOnThumb() const { return m_lclick_on_selected_thumb; }
|
||||||
|
|
||||||
bool is_horizontal() const { return !(m_flags & ImGuiSliderFlags_Vertical); }
|
bool is_horizontal() const { return !(m_flags & ImGuiSliderFlags_Vertical); }
|
||||||
bool render();
|
bool render();
|
||||||
@ -138,6 +139,8 @@ private:
|
|||||||
int m_mouse_pos;
|
int m_mouse_pos;
|
||||||
|
|
||||||
bool m_rclick_on_selected_thumb{ false };
|
bool m_rclick_on_selected_thumb{ false };
|
||||||
|
bool m_lclick_on_selected_thumb{ false };
|
||||||
|
ImVec2 m_active_thumb_center_on_lcklick;
|
||||||
|
|
||||||
bool m_draw_lower_thumb{ true };
|
bool m_draw_lower_thumb{ true };
|
||||||
bool m_combine_thumbs { false };
|
bool m_combine_thumbs { false };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user