Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent toolbar clicking when mouse is hovering over layer height editor #6727

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3967,9 +3967,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#ifdef SLIC3R_DEBUG_MOUSE_EVENTS
printf((format_mouse_event_debug_message(evt) + " - other\n").c_str());
#endif /* SLIC3R_DEBUG_MOUSE_EVENTS */
}
}
const int selected_object_idx = m_selection.get_object_idx();
const int layer_editing_object_idx = is_layers_editing_enabled() ? selected_object_idx : -1;
const bool mouse_in_layer_editing = layer_editing_object_idx != -1 && m_layers_editing.bar_rect_contains(*this, pos(0), pos(1));

if (m_main_toolbar.on_mouse(evt, *this)) {
if (!mouse_in_layer_editing && m_main_toolbar.on_mouse(evt, *this)) {
if (m_main_toolbar.is_any_item_pressed())
m_gizmos.reset_all_states();
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
Expand All @@ -3979,14 +3982,14 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
}

//BBS: GUI refactor: GLToolbar
if (m_assemble_view_toolbar.on_mouse(evt, *this)) {
if (!mouse_in_layer_editing && m_assemble_view_toolbar.on_mouse(evt, *this)) {
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
mouse_up_cleanup();
m_mouse.set_start_position_3D_as_invalid();
return;
}

if (wxGetApp().plater()->get_collapse_toolbar().on_mouse(evt, *this)) {
if (!mouse_in_layer_editing && wxGetApp().plater()->get_collapse_toolbar().on_mouse(evt, *this)) {
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
mouse_up_cleanup();
m_mouse.set_start_position_3D_as_invalid();
Expand Down Expand Up @@ -4015,7 +4018,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_dirty = true;
};

if (m_gizmos.on_mouse(evt)) {
if (!mouse_in_layer_editing && m_gizmos.on_mouse(evt)) {
if (m_gizmos.is_running()) {
_deactivate_arrange_menu();
_deactivate_orient_menu();
Expand Down Expand Up @@ -4067,10 +4070,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)

bool any_gizmo_active = m_gizmos.get_current() != nullptr;

int selected_object_idx = m_selection.get_object_idx();
int layer_editing_object_idx = is_layers_editing_enabled() ? selected_object_idx : -1;


if (m_mouse.drag.move_requires_threshold && m_mouse.is_move_start_threshold_position_2D_defined() && m_mouse.is_move_threshold_met(pos)) {
m_mouse.drag.move_requires_threshold = false;
m_mouse.set_move_start_threshold_position_2D_as_invalid();
Expand Down Expand Up @@ -4124,7 +4123,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)

// If user pressed left or right button we first check whether this happened on a volume or not.
m_layers_editing.state = LayersEditing::Unknown;
if (layer_editing_object_idx != -1 && m_layers_editing.bar_rect_contains(*this, pos(0), pos(1))) {
if (mouse_in_layer_editing) {
// A volume is selected and the mouse is inside the layer thickness bar.
// Start editing the layer height.
m_layers_editing.state = LayersEditing::Editing;
Expand Down