//-------------------------------------------------------------------------------------------------- public override bool OnMouseUp(MouseEventData data, bool shiftSelected) { if (_RotateMode != RotateMode.None) { _RotateMode = RotateMode.None; WorkspaceController.HudManager?.SetCursor(null); _AxisHintLine?.Remove(); _AxisHintLine = null; WorkspaceController.HudManager?.RemoveElement(_DeltaHudElement); _DeltaHudElement = null; if (Delta != 0) { // Commit Stop(); IsFinished = true; } WorkspaceController.Invalidate(); return(true); } return(base.OnMouseUp(data, shiftSelected)); }
//-------------------------------------------------------------------------------------------------- public override bool OnMouseMove(MouseEventData data) { if (_RotateMode != RotateMode.None) { Pnt resultPnt; if (!WorkspaceController.ActiveViewport.ScreenToPoint(_RotationPlane, (int)data.ScreenPoint.X, (int)data.ScreenPoint.Y, out resultPnt)) { return(false); } var planeDelta = ProjLib.Project(_RotationPlane, resultPnt); Delta = Dir2d.DX.Angle(new Dir2d(planeDelta.Coord)) - _StartValue; // Transform into unrotated frame //Debug.WriteLine(">> {0} {1} {2}", Delta.x, Delta.y, Delta.z); //Delta.Transform(_InverseRotation); //Debug.WriteLine("<< {0} {1} {2}", Delta.x, Delta.y, Delta.z); if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { Delta = Maths.RoundToNearest(Delta, 5.0.ToRad()); } _UpdateGizmo(); data.ForceReDetection = true; if (_DeltaHudElement == null) { _DeltaHudElement = WorkspaceController.HudManager?.CreateElement <DeltaHudElement>(this); _DeltaHudElement.Units = ValueUnits.Degree; } _DeltaHudElement.Delta = Delta.ToDeg(); return(base.OnMouseMove(data)); } return(false); }