WIP to merge with previous commit

This commit is contained in:
YuSanka 2024-05-10 09:58:49 +02:00 committed by Lukas Matena
parent 7d2c0be4a7
commit 5d14f25620
4 changed files with 16 additions and 6 deletions

View File

@ -647,8 +647,10 @@ 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()) else if (m_ctrl.IsLClickOnThumb() && can_edit() &&
!m_ticks.has_tick(m_ctrl.GetActivePos())) {
add_code_as_tick(ColorChange); add_code_as_tick(ColorChange);
}
// draw action buttons // draw action buttons

View File

@ -257,6 +257,16 @@ ImRect ImGuiControl::GetActiveThumbRect() const
return m_selection == ssLower ? m_regions.lower_thumb : m_regions.higher_thumb; 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) void ImGuiControl::draw_scroll_line(const ImRect& scroll_line, const ImRect& slideable_region)
{ {
if (m_cb_draw_scroll_line) if (m_cb_draw_scroll_line)
@ -524,9 +534,7 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos,
(m_active_thumb_center_on_lcklick.y == active_thumb_center.y) && (m_active_thumb_center_on_lcklick.y == active_thumb_center.y) &&
(m_active_thumb_center_on_lcklick.x == active_thumb_center.x) ) (m_active_thumb_center_on_lcklick.x == active_thumb_center.x) )
m_lclick_on_selected_thumb = true; m_lclick_on_selected_thumb = true;
} }
else
m_lclick_on_selected_thumb = false;
// render slider // render slider

View File

@ -84,7 +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 IsLClickOnThumb();
bool is_horizontal() const { return !(m_flags & ImGuiSliderFlags_Vertical); } bool is_horizontal() const { return !(m_flags & ImGuiSliderFlags_Vertical); }
bool render(); bool render();

View File

@ -113,7 +113,6 @@ class TickCodeManager
ExtrudersSequence m_extruders_sequence; ExtrudersSequence m_extruders_sequence;
bool has_tick_with_code(Type type); 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); 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); 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 add_tick(const int tick, Type type, int extruder, double print_z);
bool edit_tick(std::set<TickCode>::iterator it, double print_z); bool edit_tick(std::set<TickCode>::iterator it, double print_z);
void switch_code(Type type_from, Type type_to); void switch_code(Type type_from, Type type_to);