mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 06:33:57 -06:00
Various gizmos refactoring
This commit is contained in:
parent
30af274d44
commit
9dbb2dfe0d
22 changed files with 292 additions and 451 deletions
|
@ -29,7 +29,16 @@ const float GLGizmoRotate::GrabberOffset = 0.15f; // in percent of radius
|
|||
GLGizmoRotate::GLGizmoRotate(GLCanvas3D& parent, GLGizmoRotate::Axis axis)
|
||||
: GLGizmoBase(parent, "", -1)
|
||||
, m_axis(axis)
|
||||
{}
|
||||
, m_drag_color(DEFAULT_DRAG_COLOR)
|
||||
, m_highlight_color(DEFAULT_HIGHLIGHT_COLOR)
|
||||
{
|
||||
m_group_id = static_cast<int>(axis);
|
||||
}
|
||||
|
||||
void GLGizmoRotate::set_highlight_color(const ColorRGBA &color)
|
||||
{
|
||||
m_highlight_color = color;
|
||||
}
|
||||
|
||||
void GLGizmoRotate::set_angle(double angle)
|
||||
{
|
||||
|
@ -58,6 +67,21 @@ bool GLGizmoRotate::on_mouse(const wxMouseEvent &mouse_event)
|
|||
|
||||
void GLGizmoRotate::dragging(const UpdateData &data) { on_dragging(data); }
|
||||
|
||||
void GLGizmoRotate::start_dragging()
|
||||
{
|
||||
m_grabbers[0].dragging = true;
|
||||
on_start_dragging();
|
||||
}
|
||||
|
||||
void GLGizmoRotate::stop_dragging()
|
||||
{
|
||||
m_grabbers[0].dragging = false;
|
||||
on_stop_dragging();
|
||||
}
|
||||
|
||||
void GLGizmoRotate::enable_grabber() { m_grabbers[0].enabled = true; }
|
||||
void GLGizmoRotate::disable_grabber() { m_grabbers[0].enabled = false; }
|
||||
|
||||
bool GLGizmoRotate::on_init()
|
||||
{
|
||||
m_grabbers.push_back(Grabber());
|
||||
|
@ -456,10 +480,6 @@ GLGizmoRotate3D::GLGizmoRotate3D(GLCanvas3D& parent, const std::string& icon_fil
|
|||
//BBS: GUI refactor: add obj manipulation
|
||||
, m_object_manipulation(obj_manipulation)
|
||||
{
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
m_gizmos[i].set_group_id(i);
|
||||
}
|
||||
|
||||
load_rotoptimize_state();
|
||||
}
|
||||
|
||||
|
@ -475,6 +495,25 @@ bool GLGizmoRotate3D::on_mouse(const wxMouseEvent &mouse_event) {
|
|||
return use_grabbers(mouse_event);
|
||||
}
|
||||
|
||||
void GLGizmoRotate3D::data_changed() {
|
||||
const Selection &selection = m_parent.get_selection();
|
||||
bool is_wipe_tower = selection.is_wipe_tower();
|
||||
if (is_wipe_tower) {
|
||||
DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
float wipe_tower_rotation_angle =
|
||||
dynamic_cast<const ConfigOptionFloat *>(
|
||||
config.option("wipe_tower_rotation_angle"))
|
||||
->value;
|
||||
set_rotation(Vec3d(0., 0., (M_PI / 180.) * wipe_tower_rotation_angle));
|
||||
m_gizmos[0].disable_grabber();
|
||||
m_gizmos[1].disable_grabber();
|
||||
} else {
|
||||
set_rotation(Vec3d::Zero());
|
||||
m_gizmos[0].enable_grabber();
|
||||
m_gizmos[1].enable_grabber();
|
||||
}
|
||||
}
|
||||
|
||||
bool GLGizmoRotate3D::on_init()
|
||||
{
|
||||
for (GLGizmoRotate& g : m_gizmos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue