mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Fixed bug into Camera::set_target()
This commit is contained in:
parent
a624590b36
commit
55a4b99e44
2 changed files with 10 additions and 8 deletions
|
@ -91,14 +91,16 @@ void Camera::select_next_type()
|
||||||
|
|
||||||
void Camera::set_target(const Vec3d& target)
|
void Camera::set_target(const Vec3d& target)
|
||||||
{
|
{
|
||||||
// We may let these factors be customizable
|
|
||||||
static const double ScaleFactor = 1.1;
|
|
||||||
BoundingBoxf3 test_box = m_scene_box;
|
BoundingBoxf3 test_box = m_scene_box;
|
||||||
|
test_box.translate(-m_scene_box.center());
|
||||||
|
// We may let this factor be customizable
|
||||||
|
static const double ScaleFactor = 1.5;
|
||||||
test_box.scale(ScaleFactor);
|
test_box.scale(ScaleFactor);
|
||||||
m_target = target;
|
test_box.translate(m_scene_box.center());
|
||||||
m_target(0) = clamp(test_box.min(0), test_box.max(0), m_target(0));
|
|
||||||
m_target(1) = clamp(test_box.min(1), test_box.max(1), m_target(1));
|
m_target(0) = clamp(test_box.min(0), test_box.max(0), target(0));
|
||||||
m_target(2) = clamp(test_box.min(2), test_box.max(2), m_target(2));
|
m_target(1) = clamp(test_box.min(1), test_box.max(1), target(1));
|
||||||
|
m_target(2) = clamp(test_box.min(2), test_box.max(2), target(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::set_theta(float theta, bool apply_limit)
|
void Camera::set_theta(float theta, bool apply_limit)
|
||||||
|
|
|
@ -1373,7 +1373,7 @@ void GLCanvas3D::set_model(Model* model)
|
||||||
|
|
||||||
void GLCanvas3D::bed_shape_changed()
|
void GLCanvas3D::bed_shape_changed()
|
||||||
{
|
{
|
||||||
m_camera.set_scene_box(scene_bounding_box());
|
refresh_camera_scene_box();
|
||||||
m_camera.requires_zoom_to_bed = true;
|
m_camera.requires_zoom_to_bed = true;
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
if (m_bed.is_prusa())
|
if (m_bed.is_prusa())
|
||||||
|
@ -2116,7 +2116,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_camera.set_scene_box(scene_bounding_box());
|
refresh_camera_scene_box();
|
||||||
|
|
||||||
if (m_selection.is_empty())
|
if (m_selection.is_empty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue