mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
Merge branch 'master' into tm_slice_index_lyrh
This commit is contained in:
commit
b4ea43a6b0
7 changed files with 30 additions and 19 deletions
|
@ -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)
|
||||
|
|
|
@ -238,6 +238,8 @@ private:
|
|||
bool right;
|
||||
GLCanvas3D* parent;
|
||||
|
||||
MouseCapture() { reset(); }
|
||||
|
||||
bool any() const { return left || middle || right; }
|
||||
void reset() { left = middle = right = false; parent = nullptr; }
|
||||
};
|
||||
|
|
|
@ -1713,8 +1713,8 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||
object->center_around_origin();
|
||||
new_instances.emplace_back(object->add_instance());
|
||||
#else /* AUTOPLACEMENT_ON_LOAD */
|
||||
// if object has no defined position(s) we need to rearrange everything after loading object->center_around_origin();
|
||||
need_arrange = true;
|
||||
// if object has no defined position(s) we need to rearrange everything after loading
|
||||
need_arrange = true;
|
||||
// add a default instance and center object around origin
|
||||
object->center_around_origin(); // also aligns object to Z = 0
|
||||
ModelInstance* instance = object->add_instance();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue