public void GLContext_MouseDown(object sender, MouseEventArgs e) { ActiveDragObject = null; Timeline timeline = Program.MainTimeline; if (timeline.SelectedLayer == null) { return; } if (timeline.SelectedKeyframe == null) { return; } Point location = RoundMousePos(UnprojectMousePos(e.Location)); if (timeline.SelectedLayer.Data.GetType() == typeof(StickFigure) || timeline.SelectedLayer.Data.GetType() == typeof(CustomFigure)) { StickFigurePair = StickFigure.FindJointStatePair(((StickFigure)timeline.SelectedLayer.Data).Root, ((StickFigure.State)timeline.SelectedKeyframe.State).Root, location); } ManipulateResult result = timeline.SelectedLayer.Data.TryManipulate( timeline.SelectedKeyframe.State, location, e.Button, ModifierKeys); if (result != null) { ActiveDragObject = result.Target; ActiveDragParams = result.Params; LastDragObject = result.Target; ActiveDragPrevState = timeline.SelectedKeyframe.State.Copy(); } Program.Form_Properties.UpdateStickFigurePanel(); }
private void GLContext_MouseDown(object sender, MouseEventArgs e) { if (ActiveManipMode == EditorManipMode.Pointer || ActiveManipMode == EditorManipMode.Move) { var pair = StickFigure.FindJointStatePair(ActiveFigure.Root, ActiveFigureState.Root, e.Location); var result = ActiveFigure.TryManipulate(ActiveFigureState, e.Location, e.Button, ModifierKeys, !IKEnabled); if (result != null && pair != null) { if (e.Button != MouseButtons.Right) { SelectedPair = pair; } if (ActiveManipMode == EditorManipMode.Move) { ActiveDragPair = pair; ActiveDragParams = result.Params; } } } else if (ActiveManipMode == EditorManipMode.Add && SelectedPair != null) { StickFigure.Joint joint = StickFigure.Joint.RelativeTo(SelectedPair.Item1, new PointF(-(SelectedPair.Item2.Location.X - e.X), -(SelectedPair.Item2.Location.Y - e.Y))); StickFigure.Joint.State state = StickFigure.Joint.State.RelativeTo(SelectedPair.Item2, new PointF(-(SelectedPair.Item2.Location.X - e.X), -(SelectedPair.Item2.Location.Y - e.Y))); SelectedPair = new Tuple <StickFigure.Joint, StickFigure.Joint.State>(joint, state); } else if (ActiveManipMode == EditorManipMode.Delete) { var pair = StickFigure.FindJointStatePair(ActiveFigure.Root, ActiveFigureState.Root, e.Location); var result = ActiveFigure.TryManipulate(ActiveFigureState, e.Location, e.Button, ModifierKeys, !IKEnabled); if (result != null) { StickFigure.Joint.State state = ((StickFigure.Joint.State)result.Target); if (state.Parent == null) // No deleting everything allowed { return; } pair.Item1.Delete(); pair.Item2.Delete(); SelectedPair = null; } } GLContext.Invalidate(); }
public void GLContext_MouseDown(object sender, MouseEventArgs e) { ActiveDragObject = null; Timeline timeline = Program.MainTimeline; if (timeline.SelectedLayer == null) return; if (timeline.SelectedKeyframe == null) return; if (timeline.SelectedLayer.Data.GetType() == typeof(StickFigure) || timeline.SelectedLayer.Data.GetType() == typeof(CustomFigure)) StickFigurePair = StickFigure.FindJointStatePair(((StickFigure)timeline.SelectedLayer.Data).Root, ((StickFigure.State)timeline.SelectedKeyframe.State).Root, e.Location); ManipulateResult result = timeline.SelectedLayer.Data.TryManipulate( timeline.SelectedKeyframe.State, e.Location, e.Button, ModifierKeys); if (result != null) { ActiveDragObject = result.Target; ActiveDragParams = result.Params; LastDragObject = result.Target; ActiveDragPrevState = timeline.SelectedKeyframe.State.Copy(); Program.Form_Properties.UpdateStickFigurePanel(); } }
public void ManipulateEnd(IManipulatable target, IManipulatableParams mparams, Point location) { }
public void ManipulateUpdate(IManipulatable _target, IManipulatableParams mparams, Point location) { State target = _target as State; target.Move(location, (ManipulateParams)mparams); }
public void ManipulateStart(IManipulatable _target, IManipulatableParams mparams, Point location) { }