Fix of #5632 (painter gizmos not working correctly with scaled objects)

This was broken since 8bcdbb7.
This commit is contained in:
Lukas Matena 2021-01-05 17:04:56 +01:00
parent 48c7673cc6
commit e733565031
2 changed files with 6 additions and 4 deletions

View file

@ -45,9 +45,11 @@ void TriangleSelector::select_patch(const Vec3f& hit, int facet_start,
m_cursor = Cursor(hit, source, radius, cursor_type, trafo);
// In case user changed cursor size since last time, update triangle edge limit.
if (m_old_cursor_radius != radius) {
set_edge_limit(radius / 5.f);
m_old_cursor_radius = radius;
// It is necessary to compare the internal radius in m_cursor! radius is in
// world coords and does not change after scaling.
if (m_old_cursor_radius_sqr != m_cursor.radius_sqr) {
set_edge_limit(std::sqrt(m_cursor.radius_sqr) / 5.f);
m_old_cursor_radius_sqr = m_cursor.radius_sqr;
}
// Now start with the facet the pointer points to and check all adjacent facets.

View file

@ -146,7 +146,7 @@ protected:
};
Cursor m_cursor;
float m_old_cursor_radius;
float m_old_cursor_radius_sqr;
// Private functions:
bool select_triangle(int facet_idx, EnforcerBlockerType type,