ENH: zooming at mouse position

https://github.com/bambulab/BambuStudio/issues/1321

Change-Id: Ifa5c2b2931a5d80c3e5e5cc05eda76263a5ac570
This commit is contained in:
liz.li 2023-03-10 11:55:00 +08:00 committed by Lane.Wei
parent 01bb20e4e1
commit 3f2ee4062b
3 changed files with 25 additions and 2 deletions

View file

@ -22,6 +22,7 @@ struct Camera
static double FrustrumMinNearZ;
static double FrustrumZMargin;
static double MaxFovDeg;
static double ZoomUnit;
enum class EType : unsigned char
{
@ -67,6 +68,7 @@ public:
void enable_update_config_on_type_change(bool enable) { m_update_config_on_type_change_enabled = enable; }
void translate(const Vec3d& displacement);
const Vec3d& get_target() const { return m_target; }
void set_target(const Vec3d& target);
@ -76,7 +78,7 @@ public:
double get_zoom() const { return m_zoom; }
double get_inv_zoom() const { assert(m_zoom != 0.0); return 1.0 / m_zoom; }
void update_zoom(double delta_zoom) { set_zoom(m_zoom / (1.0 - std::max(std::min(delta_zoom, 4.0), -4.0) * 0.1)); }
void update_zoom(double delta_zoom) { set_zoom(m_zoom / (1.0 - std::max(std::min(delta_zoom, 4.0), -4.0) * ZoomUnit)); }
void set_zoom(double zoom);
const BoundingBoxf3& get_scene_box() const { return m_scene_box; }