fix problems with ctrl/shift key drag modifiers
When dragging points we must always update position and mark them dirty through all code paths. Ensure the ctrl and shift modifier rotation quarternion is always set to something reasonable. separate extraLine tracking code from drag tracking codepull/948/head
parent
60dca4cb79
commit
3309181773
|
@ -270,15 +270,16 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
return;
|
||||
}
|
||||
|
||||
// We're currently dragging something; so do that. But if we haven't
|
||||
// painted since the last time we solved, do nothing, because there's
|
||||
// no sense solving a frame and not displaying it.
|
||||
if(!havePainted) {
|
||||
if(pending.operation == Pending::DRAGGING_POINTS && ctrlDown) {
|
||||
SS.extraLine.ptA = UnProjectPoint(orig.mouseOnButtonDown);
|
||||
SS.extraLine.ptB = UnProjectPoint(mp);
|
||||
SS.extraLine.draw = true;
|
||||
}
|
||||
|
||||
// We're currently dragging something; so do that. But if we haven't
|
||||
// painted since the last time we solved, do nothing, because there's
|
||||
// no sense solving a frame and not displaying it.
|
||||
if(!havePainted) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -319,9 +320,8 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
// Don't start dragging the position about the normal
|
||||
// until we're a little ways out, to get a reasonable
|
||||
// reference pos
|
||||
orig.mouse = mp;
|
||||
break;
|
||||
}
|
||||
qt = Quaternion::IDENTITY;
|
||||
} else {
|
||||
double theta = atan2(orig.mouse.y-orig.mouseOnButtonDown.y,
|
||||
orig.mouse.x-orig.mouseOnButtonDown.x);
|
||||
theta -= atan2(y-orig.mouseOnButtonDown.y,
|
||||
|
@ -329,10 +329,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
|
||||
Vector gn = projRight.Cross(projUp);
|
||||
qt = Quaternion::From(gn, -theta);
|
||||
|
||||
SS.extraLine.draw = true;
|
||||
SS.extraLine.ptA = UnProjectPoint(orig.mouseOnButtonDown);
|
||||
SS.extraLine.ptB = UnProjectPoint(mp);
|
||||
}
|
||||
} else {
|
||||
double dx = -(x - orig.mouse.x);
|
||||
double dy = -(y - orig.mouse.y);
|
||||
|
@ -340,7 +337,6 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
qt = Quaternion::From(projUp, -s*dx).Times(
|
||||
Quaternion::From(projRight, s*dy));
|
||||
}
|
||||
orig.mouse = mp;
|
||||
|
||||
// Now apply this rotation to the points being dragged.
|
||||
List<hEntity> *lhe = &(pending.points);
|
||||
|
@ -353,11 +349,10 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
p = qt.Rotate(p);
|
||||
p = p.Plus(SS.extraLine.ptA);
|
||||
e->PointForceTo(p);
|
||||
SS.MarkGroupDirtyByEntity(e->h);
|
||||
} else {
|
||||
UpdateDraggedPoint(*he, x, y);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
Quaternion q = e->PointGetQuaternion();
|
||||
Vector p = e->PointGetNum();
|
||||
q = qt.Times(q);
|
||||
|
@ -365,6 +360,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
// Let's rotate about the selected point; so fix up the
|
||||
// translation so that that point didn't move.
|
||||
e->PointForceTo(p);
|
||||
}
|
||||
SS.MarkGroupDirtyByEntity(e->h);
|
||||
}
|
||||
} else {
|
||||
|
@ -373,8 +369,8 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
UpdateDraggedPoint(*he, x, y);
|
||||
SS.MarkGroupDirtyByEntity(*he);
|
||||
}
|
||||
orig.mouse = mp;
|
||||
}
|
||||
orig.mouse = mp;
|
||||
break;
|
||||
|
||||
case Pending::DRAGGING_NEW_CUBIC_POINT: {
|
||||
|
|
Loading…
Reference in New Issue