public override void handleMouseUp(Point mouseLocation, PlayFrame frame, PitchScreenCoordConverter converter, VisualOverlay overlay) { PointF pitchCoords = converter.screenToPitchCoords(mouseLocation); if (mSelectedPlayer != null) { // This function doesn't necessarily create a trigger but regardless // we say that the tool is complete anyway. if (frame.MaybeCreateTrigger(pitchCoords, Settings.Default.PitchLength, mSelectedPlayer)) { ModelChanged = true; } IsComplete = true; } }
/// <summary> /// We capture the mouse up event and use it to place whatever it was that /// was selected on the mouse down event. If nothing was selected this does /// nothing. /// </summary> /// <param name="mouseLocation"></param> /// <param name="frame"></param> /// <param name="converter"></param> public override void handleMouseUp(Point mouseLocation, PlayFrame frame, PitchScreenCoordConverter converter, VisualOverlay overlay) { PointF pitchCoords = converter.screenToPitchCoords(mouseLocation); if (mSelectedTrigger != null) { // If we are moving a trigger then only move it if the position it is // being placed is valid. if (frame.MaybeCreateTrigger(pitchCoords, SELECTION_MAX_DISTANCE, mSelectedTrigger.AffectedPlayer)) { frame.RemoveTrigger(mSelectedTrigger); ModelChanged = true; } } else if (mSelectedPlayer != null) { frame.PlayerMovement[mSelectedPlayer][0].FinalPosition = pitchCoords; ModelChanged = true; } else if (mSelectedCut != null) { mSelectedCut.FinalPosition = pitchCoords; ModelChanged = true; } else if (mIsMovingDiscControlPoint) { frame.DiscFrameMovement.ControlPoint = pitchCoords; ModelChanged = true; } // Regardless of whether anything moved the move tool is complete on // mouse up. mSelectedCut = null; mSelectedPlayer = null; mSelectedTrigger = null; IsComplete = true; }