mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 23:15:58 +08:00
Merge branch 'ys_spe2291'
This commit is contained in:
commit
435b4ddf23
@ -647,6 +647,10 @@ void DSForLayers::Render(const int canvas_width, const int canvas_height, float
|
||||
// discard all getters dialogs
|
||||
m_show_get_jump_value = false;
|
||||
}
|
||||
else if (m_ctrl.IsLClickOnThumb() && can_edit() &&
|
||||
!m_ticks.has_tick(m_ctrl.GetActivePos())) {
|
||||
add_code_as_tick(ColorChange);
|
||||
}
|
||||
|
||||
// draw action buttons
|
||||
|
||||
|
@ -257,6 +257,16 @@ ImRect ImGuiControl::GetActiveThumbRect() const
|
||||
return m_selection == ssLower ? m_regions.lower_thumb : m_regions.higher_thumb;
|
||||
}
|
||||
|
||||
bool ImGuiControl::IsLClickOnThumb()
|
||||
{
|
||||
if (m_lclick_on_selected_thumb) {
|
||||
// discard left mouse click at list its value is checked to avoud reuse it on next frame
|
||||
m_lclick_on_selected_thumb = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ImGuiControl::draw_scroll_line(const ImRect& scroll_line, const ImRect& slideable_region)
|
||||
{
|
||||
if (m_cb_draw_scroll_line)
|
||||
@ -515,6 +525,17 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos,
|
||||
context.IO.MouseClicked[0])
|
||||
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;
|
||||
}
|
||||
|
||||
// render slider
|
||||
|
||||
ImVec2 higher_thumb_center = m_regions.higher_thumb.GetCenter();
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
ImRect GetActiveThumbRect() const;
|
||||
|
||||
bool IsRClickOnThumb() const { return m_rclick_on_selected_thumb; }
|
||||
bool IsLClickOnThumb();
|
||||
|
||||
bool is_horizontal() const { return !(m_flags & ImGuiSliderFlags_Vertical); }
|
||||
bool render();
|
||||
@ -138,6 +139,8 @@ private:
|
||||
int m_mouse_pos;
|
||||
|
||||
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_combine_thumbs { false };
|
||||
|
@ -113,7 +113,6 @@ class TickCodeManager
|
||||
ExtrudersSequence m_extruders_sequence;
|
||||
|
||||
bool has_tick_with_code(Type type);
|
||||
bool has_tick(int tick);
|
||||
|
||||
std::string get_color_for_tick(TickCode tick, Type type, const int extruder);
|
||||
|
||||
@ -149,6 +148,7 @@ public:
|
||||
|
||||
void set_ticks(const Info& custom_gcode_per_print_z);
|
||||
|
||||
bool has_tick(int tick);
|
||||
bool add_tick(const int tick, Type type, int extruder, double print_z);
|
||||
bool edit_tick(std::set<TickCode>::iterator it, double print_z);
|
||||
void switch_code(Type type_from, Type type_to);
|
||||
|
Loading…
x
Reference in New Issue
Block a user