Skip to content

Commit

Permalink
#5746: Add grid-snapping support to TextureTranslator, now it behaves…
Browse files Browse the repository at this point in the history
… the same as the regular drag operator used on map objects.
  • Loading branch information
codereader committed Sep 26, 2021
1 parent b8b08aa commit f075ed2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions radiantcore/selection/textool/TextureToolDragManipulator.cpp
Expand Up @@ -32,6 +32,14 @@ void TextureTranslator::transform(const Matrix4& pivot2world, const VolumeTest&
diff[fabs(diff.y()) > fabs(diff.x()) ? 0 : 1] = 0;
}

// Snap to grid if the constraint flag is set
if (constraintFlags & Constraint::Grid)
{
auto gridSize = GlobalGrid().getGridSize(grid::Space::Texture);
diff.x() = float_snapped(diff.x(), gridSize);
diff.y() = float_snapped(diff.y(), gridSize);
}

_translateFunctor(diff);
}

Expand Down

0 comments on commit f075ed2

Please sign in to comment.