mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Cut Gizmo -> added movements using arrow keys:
Up arrow = increase Z by 1mm Down arrow = decrease Z by 1mm
This commit is contained in:
parent
c09091c407
commit
8453c88482
3 changed files with 22 additions and 2 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +191,7 @@ void GLGizmoCut::update_max_z(const Selection& selection) const
|
||||||
void GLGizmoCut::set_cut_z(double cut_z) const
|
void GLGizmoCut::set_cut_z(double cut_z) const
|
||||||
{
|
{
|
||||||
// Clamp the plane to the object's bounding box
|
// Clamp the plane to the object's bounding box
|
||||||
m_cut_z = std::max(0.0, std::min(m_max_z, cut_z));
|
m_cut_z = std::clamp(cut_z, 0.0, m_max_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoCut::perform_cut(const Selection& selection)
|
void GLGizmoCut::perform_cut(const Selection& selection)
|
||||||
|
|
|
@ -25,6 +25,9 @@ class GLGizmoCut : public GLGizmoBase
|
||||||
public:
|
public:
|
||||||
GLGizmoCut(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
GLGizmoCut(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||||
|
|
||||||
|
double get_cut_z() const { return m_cut_z; }
|
||||||
|
void set_cut_z(double cut_z) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_init();
|
virtual bool on_init();
|
||||||
virtual void on_load(cereal::BinaryInputArchive& ar) { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
|
virtual void on_load(cereal::BinaryInputArchive& ar) { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
|
||||||
|
@ -40,7 +43,6 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_max_z(const Selection& selection) const;
|
void update_max_z(const Selection& selection) const;
|
||||||
void set_cut_z(double cut_z) const;
|
|
||||||
void perform_cut(const Selection& selection);
|
void perform_cut(const Selection& selection);
|
||||||
double calc_projection(const Linef3& mouse_ray) const;
|
double calc_projection(const Linef3& mouse_ray) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -815,6 +815,22 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
||||||
default: { break; }
|
default: { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_current == Cut)
|
||||||
|
{
|
||||||
|
auto do_move = [this, &processed](double delta_z) {
|
||||||
|
GLGizmoCut* cut = dynamic_cast<GLGizmoCut*>(get_current());
|
||||||
|
cut->set_cut_z(delta_z + cut->get_cut_z());
|
||||||
|
m_parent.set_as_dirty();
|
||||||
|
processed = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (keyCode)
|
||||||
|
{
|
||||||
|
case WXK_NUMPAD_UP: case WXK_UP: { do_move(1.0); break; }
|
||||||
|
case WXK_NUMPAD_DOWN: case WXK_DOWN: { do_move(-1.0); break; }
|
||||||
|
default: { break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (processed)
|
// if (processed)
|
||||||
// m_parent.set_cursor(GLCanvas3D::Standard);
|
// m_parent.set_cursor(GLCanvas3D::Standard);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue