From 775e2eea185429ca2c719db89f0cf14061648e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiago=20L=C3=B6pes?= Date: Sat, 18 Apr 2026 18:50:51 -0300 Subject: [PATCH] Update wall-drafting.ts --- .../src/components/tools/wall/wall-drafting.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/components/tools/wall/wall-drafting.ts b/packages/editor/src/components/tools/wall/wall-drafting.ts index b6e18c1a0..6bd59c5c7 100755 --- a/packages/editor/src/components/tools/wall/wall-drafting.ts +++ b/packages/editor/src/components/tools/wall/wall-drafting.ts @@ -62,10 +62,15 @@ export function snapPointTo45Degrees( const snappedAngle = Math.round(angle / angleStep) * angleStep const distance = Math.sqrt(dx * dx + dz * dz) - return snapPointToGrid([ - start[0] + Math.cos(snappedAngle) * distance, - start[1] + Math.sin(snappedAngle) * distance, - ], step) + // Snap do comprimento ao grid step (não das coordenadas absolutas) + // Isso preserva o start exato e garante que a parede perpendicular + // comece e termine no ponto certo, sem micro-gaps + const snappedDistance = Math.round(distance / step) * step + + return [ + start[0] + Math.cos(snappedAngle) * snappedDistance, + start[1] + Math.sin(snappedAngle) * snappedDistance, + ] } export function getWallAngleSnapStep(step = getWallGridStep()): number {