summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2011-01-12 22:51:28 +0000
committerleo2011-01-12 22:51:28 +0000
commit96080b2eebec780114b5ea0b93d198a03726b302 (patch)
tree7bbe8549e9458a441e990a34b110d44e0ce0d114
parentb135c2a60edbe93ef731963fa92dcc08283eecb4 (diff)
Fixed precision move using the keyboard.
git-svn-id: http://svn.leocad.org/branches/leocad-0.75@966 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/project.cpp20
-rw-r--r--common/project.h2
2 files changed, 11 insertions, 11 deletions
diff --git a/common/project.cpp b/common/project.cpp
index 55c3417..6a3b4d1 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -7253,7 +7253,7 @@ void Project::SnapRotationVector(Vector3& Delta, Vector3& Leftover) const
}
}
-bool Project::MoveSelectedObjects(Vector3& Move, Vector3& Remainder)
+bool Project::MoveSelectedObjects(Vector3& Move, Vector3& Remainder, bool Snap)
{
// Don't move along locked directions.
if (m_nSnap & LC_DRAW_LOCK_X)
@@ -7266,10 +7266,13 @@ bool Project::MoveSelectedObjects(Vector3& Move, Vector3& Remainder)
Move[2] = 0;
// Snap.
- SnapVector(Move, Remainder);
+ if (Snap)
+ {
+ SnapVector(Move, Remainder);
- if (Move.LengthSquared() < 0.001f)
- return false;
+ if (Move.LengthSquared() < 0.001f)
+ return false;
+ }
// Transform the translation if we're in relative mode.
if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
@@ -7288,9 +7291,6 @@ bool Project::MoveSelectedObjects(Vector3& Move, Vector3& Remainder)
}
}
- if (Move.LengthSquared() < 0.001f)
- return false;
-
Piece* pPiece;
Camera* pCamera;
Light* pLight;
@@ -7848,7 +7848,7 @@ bool Project::OnKeyDown(char nKey, bool bControl, bool bShift)
else
{
Vector3 tmp;
- MoveSelectedObjects(axis, tmp);
+ MoveSelectedObjects(axis, tmp, false);
}
UpdateOverlayScale();
@@ -8650,7 +8650,7 @@ void Project::OnMouseMove(int x, int y, bool bControl, bool bShift)
m_nDownY = y;
Vector3 Delta = MoveX + MoveY + m_MouseSnapLeftover;
- Redraw = MoveSelectedObjects(Delta, m_MouseSnapLeftover);
+ Redraw = MoveSelectedObjects(Delta, m_MouseSnapLeftover, true);
m_MouseTotalDelta += Delta;
}
else
@@ -8683,7 +8683,7 @@ void Project::OnMouseMove(int x, int y, bool bControl, bool bShift)
m_nDownX = x;
m_nDownY = y;
- Redraw = MoveSelectedObjects(TotalMove, m_MouseSnapLeftover);
+ Redraw = MoveSelectedObjects(TotalMove, m_MouseSnapLeftover, true);
}
SystemUpdateFocus(NULL);
diff --git a/common/project.h b/common/project.h
index f4bb61c..d48ecbd 100644
--- a/common/project.h
+++ b/common/project.h
@@ -173,7 +173,7 @@ protected:
void CalculateStep();
// Movement.
- bool MoveSelectedObjects(Vector3& Move, Vector3& Remainder);
+ bool MoveSelectedObjects(Vector3& Move, Vector3& Remainder, bool Snap);
bool RotateSelectedObjects(Vector3& Delta, Vector3& Remainder);
void SnapVector(Vector3& Delta) const
{