Made ctrl restrict XY rotation and scaling to only one axis.
Originally committed to SVN as r1354.
This commit is contained in:
parent
93571ce295
commit
4f7bb0f6a8
2 changed files with 20 additions and 4 deletions
|
@ -198,9 +198,17 @@ void VisualToolRotateXY::UpdateHold() {
|
|||
float screenAngleX = (orgy-mouseY*sh/h)*2.0;
|
||||
float screenAngleY = (mouseX*sw/w-orgx)*2.0;
|
||||
|
||||
// Deltas
|
||||
float deltaX = screenAngleX - startAngleX;
|
||||
float deltaY = screenAngleY - startAngleY;
|
||||
if (ctrlDown) {
|
||||
if (fabs(deltaX) >= fabs(deltaY)) deltaY = 0;
|
||||
else deltaX = 0;
|
||||
}
|
||||
|
||||
// Calculate
|
||||
curAngleX = screenAngleX - startAngleX + origAngleX;
|
||||
curAngleY = screenAngleY - startAngleY + origAngleY;
|
||||
curAngleX = deltaX + origAngleX;
|
||||
curAngleY = deltaY + origAngleY;
|
||||
while (curAngleX < 0.0) curAngleX += 360.0;
|
||||
while (curAngleX >= 360.0) curAngleX -= 360.0;
|
||||
while (curAngleY < 0.0) curAngleY += 360.0;
|
||||
|
|
|
@ -151,9 +151,17 @@ void VisualToolScale::InitializeHold() {
|
|||
///////////////
|
||||
// Update hold
|
||||
void VisualToolScale::UpdateHold() {
|
||||
// Deltas
|
||||
int deltaX = mouseX - startX;
|
||||
int deltaY = startY - mouseY;
|
||||
if (ctrlDown) {
|
||||
if (abs(deltaX) >= abs(deltaY)) deltaY = 0;
|
||||
else deltaX = 0;
|
||||
}
|
||||
|
||||
// Calculate
|
||||
curScaleX = (float(mouseX - startX)/0.8f) + origScaleX;
|
||||
curScaleY = (float(startY - mouseY)/0.8f) + origScaleY;
|
||||
curScaleX = (float(deltaX)/0.8f) + origScaleX;
|
||||
curScaleY = (float(deltaY)/0.8f) + origScaleY;
|
||||
if (curScaleX < 0.0f) curScaleX = 0.0f;
|
||||
if (curScaleY < 0.0f) curScaleY = 0.0f;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue