Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-03-26 11:01:04 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-03-26 11:01:04 +0300
commit3818bfa19ac19d1790f514c8604b30c0b9926e70 (patch)
tree4df1ff528ba6700ac38963bc48fd408b01db3bb1 /src/slic3r/GUI/GLToolbar.cpp
parenta8cf701520ab9755105c1cd958ecee2247152f41 (diff)
parent3e0ec8098bce46673c4b0325b85825008ead9d03 (diff)
1st installment of gizmos refactoring
1) GLCanvas3D::Gizmos moved into a standalone class GLGizmosManager 2) GLGizmosManager handles mouse events by calling its on_mouse method (wip)
Diffstat (limited to 'src/slic3r/GUI/GLToolbar.cpp')
-rw-r--r--src/slic3r/GUI/GLToolbar.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp
index ac79784ad..de3236fc8 100644
--- a/src/slic3r/GUI/GLToolbar.cpp
+++ b/src/slic3r/GUI/GLToolbar.cpp
@@ -157,7 +157,6 @@ GLToolbar::GLToolbar(GLToolbar::EType type)
#if ENABLE_SVG_ICONS
, m_icons_texture_dirty(true)
#endif // ENABLE_SVG_ICONS
- , m_mouse_capture({ false, false, false, nullptr })
, m_tooltip("")
{
}
@@ -410,6 +409,16 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
bool processed = false;
// mouse anywhere
+ if (!evt.Dragging() && !evt.Leaving() && !evt.Entering() && (m_mouse_capture.parent != nullptr))
+ {
+ if (m_mouse_capture.any() && (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()))
+ // prevents loosing selection into the scene if mouse down was done inside the toolbar and mouse up was down outside it,
+ // as when switching between views
+ processed = true;
+
+ m_mouse_capture.reset();
+ }
+
if (evt.Moving())
m_tooltip = update_hover_state(mouse_pos, parent);
else if (evt.LeftUp())
@@ -418,17 +427,9 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
m_mouse_capture.middle = false;
else if (evt.RightUp())
m_mouse_capture.right = false;
- else if (m_mouse_capture.any())
- {
- if (evt.Dragging())
- processed = true;
- else if (evt.Entering() && (m_mouse_capture.parent == &parent))
- // Resets the mouse capture state to avoid setting the dragging event as processed when, for example,
- // the item action opens a modal dialog
- // Keeps the mouse capture state if the entering event happens on different parent from the one
- // who received the button down event, to prevent, for example, dragging when switching between scene views
- m_mouse_capture.reset();
- }
+ else if (evt.Dragging() && m_mouse_capture.any())
+ // if the button down was done on this toolbar, prevent from dragging into the scene
+ processed = true;
int item_id = contains_mouse(mouse_pos, parent);
if (item_id == -1)
@@ -443,11 +444,16 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
{
m_mouse_capture.left = true;
m_mouse_capture.parent = &parent;
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ processed = true;
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if ((item_id != -2) && !m_items[item_id]->is_separator())
{
// mouse is inside an icon
do_action((unsigned int)item_id, parent);
- processed = true;
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+// processed = true;
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}
}
else if (evt.MiddleDown())