private void OnMouseUp( object sender, MouseEventArgs args ) { if ( ( args.Button & m_ActionButton ) == 0 ) { return; } if ( UsingPickAction ) { if ( !m_PickAction.HasModifiedObjects ) { object obj = m_LastCursorPick == null ? null : m_LastCursorPick.IntersectedObject; if ( obj != null ) { EditorState.Instance.CurrentSelection.ApplySelect( obj, m_AddToSelection ); } } else { EditorState.Instance.CurrentUndoStack.Push( m_PickAction ); } m_PickAction = null; } else { object[] objects = null; if ( ( m_SelectionStart.X == args.X ) && ( m_SelectionStart.Y == args.Y ) ) { ILineIntersection pick = ( ( IPicker )sender ).FirstPick( args.X, args.Y, SelectionPickOptions ); if ( pick != null ) { objects = new object[] { pick.IntersectedObject }; } } else { objects = ( ( IPicker )sender ).GetObjectsInBox( m_SelectionStart.X, m_SelectionStart.Y, args.X, args.Y ); } // If any objects are modifiers, then if ( ( objects != null ) && ( objects.Length > 0 ) ) { EditorState.Instance.CurrentSelection.ApplySelect( objects, m_AddToSelection ); } else if ( !m_AddToSelection ) { EditorState.Instance.CurrentSelection.ClearSelection( ); } } }
/// <summary> /// Returns true if the specified action is a move action /// </summary> /// <param name="action">Action to check</param> /// <returns>true if action is a <see cref="MoveAction"/></returns> public bool SupportsPickAction( IPickAction action ) { return action is MoveAction; }
private void OnMouseDown( object sender, MouseEventArgs args ) { if ( ( args.Button & m_ActionButton ) == 0 ) { return; } m_SelectionStart = args.Location; if ( m_CursorPick == null ) { m_PickAction = null; } else { IPickable pickable = m_CursorPick.IntersectedObject as IPickable; if ( pickable != null ) { SelectionSet selection = EditorState.Instance.CurrentSelection; m_PickAction = pickable.CreatePickAction( m_CursorPick ); if ( m_PickAction != null ) { m_PickAction.AddObjects( selection.Selection ); if ( !selection.IsSelected( pickable ) ) { m_PickAction.AddObjects( new object[] { pickable } ); } } } } }