Cap scaling to grid size

This commit is contained in:
Liebranca 2024-09-09 05:38:00 -03:00 committed by David Capello
parent d6ddaa7a27
commit dca06a53c0

View File

@ -417,20 +417,21 @@ gfx::RectF MovingCelState::calcFullBounds() const
void MovingCelState::snapBoundsToGrid(gfx::RectF& celBounds) const
{
const gfx::RectF& gridBounds = m_editor->getSite().gridBounds();
if (m_scaled) {
gfx::PointF gridOffset(
snap_to_grid(
m_editor->getSite().gridBounds(),
gridBounds,
gfx::Point(celBounds.w, celBounds.h),
PreferSnapTo::ClosestGridVertex));
celBounds.w = gridOffset.x;
celBounds.h = gridOffset.y;
celBounds.w = std::max(gridBounds.w, gridOffset.x);
celBounds.h = std::max(gridBounds.h, gridOffset.y);
}
else if (m_moved) {
gfx::PointF gridOffset(
snap_to_grid(
m_editor->getSite().gridBounds(),
gridBounds,
gfx::Point(celBounds.origin()),
PreferSnapTo::ClosestGridVertex));