Fixed grid and rotation snapping to be more sensible.

This commit is contained in:
Michael Mainguy 2024-04-21 07:51:15 -05:00
parent 81c61fc6f8
commit f9127df48a

View File

@ -207,13 +207,17 @@ export class Base {
this.grabbedMeshParentId = null; this.grabbedMeshParentId = null;
if (!mesh.physicsBody) { if (!mesh.physicsBody) {
const transform = new TransformNode('temp', this.scene); const transform = new TransformNode('temp', this.scene);
transform.rotation = mesh.rotation;
transform.position = this.pickPoint; transform.position = this.pickPoint;
mesh.setParent(transform); mesh.setParent(transform);
transform.position = snapGridVal(transform.position, this.diagramManager._config.current.gridSnap).clone(); mesh.rotation = snapRotateVal(mesh.rotation, this.diagramManager._config.current.rotateSnap);
transform.rotation = snapRotateVal(transform.rotation, this.diagramManager._config.current.rotateSnap); transform.position = snapGridVal(transform.position, this.diagramManager._config.current.gridSnap);
mesh.setParent(null); mesh.setParent(null);
mesh.position = snapGridVal(mesh.position, this.diagramManager._config.current.gridSnap);
//mesh.position = snapGridVal(mesh.position, this.diagramManager._config.current.gridSnap);
//mesh.setPivotPoint(transform.position, Space.WORLD)
//transform.dispose();
} }
this.previousParentId = null; this.previousParentId = null;
this.previousScaling = null; this.previousScaling = null;