/// <summary> /// Left mouse is released. /// New object is created and resized. /// </summary> public override void OnMouseUp(DrawingCanvas drawingCanvas, MouseButtonEventArgs e) { if (drawingCanvas.Count > 0) { drawingCanvas[drawingCanvas.Count - 1].Normalize(); drawingCanvas.AddCommandToHistory(new CommandAdd(drawingCanvas[drawingCanvas.Count - 1])); } //drawingCanvas.Tool = ToolType.Pointer; drawingCanvas.Cursor = HelperFunctions.DefaultCursor; drawingCanvas.ReleaseMouseCapture(); }
/// <summary> /// Left mouse is released. /// New object is created and resized. /// </summary> public override void OnMouseUp(DrawingCanvas drawingCanvas, MouseButtonEventArgs e) { drawingCanvas.Tool = ToolType.Pointer; drawingCanvas.Cursor = HelperFunctions.DefaultCursor; drawingCanvas.ReleaseMouseCapture(); if (drawingCanvas.Count > 0) { drawingCanvas[drawingCanvas.Count - 1].Normalize(); GraphicsText t = drawingCanvas[drawingCanvas.Count - 1] as GraphicsText; if ( t != null ) { // Create textbox for editing of graphics object which is just created CreateTextBox(t, drawingCanvas); } } // Commnnd will be added to History later, after closing // in-place textbox. }
/// <summary> /// Handle mouse up. /// Return to normal state. /// </summary> public override void OnMouseUp(DrawingCanvas drawingCanvas, MouseButtonEventArgs e) { if ( ! drawingCanvas.IsMouseCaptured ) { drawingCanvas.Cursor = HelperFunctions.DefaultCursor; selectMode = SelectionMode.None; return; } if (resizedObject != null) { // after resizing resizedObject.Normalize(); // Special case for text if (resizedObject is GraphicsText) { ((GraphicsText)resizedObject).UpdateRectangle(); } resizedObject = null; } if ( selectMode == SelectionMode.GroupSelection ) { GraphicsSelectionRectangle r = (GraphicsSelectionRectangle)drawingCanvas[drawingCanvas.Count - 1]; r.Normalize(); Rect rect = r.Rectangle; drawingCanvas.GraphicsList.Remove(r); foreach(GraphicsBase g in drawingCanvas.GraphicsList) { if ( g.IntersectsWith(rect) ) { g.IsSelected = true; } } } drawingCanvas.ReleaseMouseCapture(); drawingCanvas.Cursor = HelperFunctions.DefaultCursor; selectMode = SelectionMode.None; AddChangeToHistory(drawingCanvas); }