protected void ClearSelection() { if (TSFrame != null) { if (TSFrame.Parent is Canvas) { (TSFrame.Parent as Canvas).Children.Remove(TSFrame); TSFrame = null; } DraggingPoint = null; if (FrameChanged != null) { FrameChanged(null); } } if (SelectionRect != null) { if (SelectionRect.Parent is Canvas) { (SelectionRect.Parent as Canvas).Children.Remove(SelectionRect); SelectionRect = null; } } }
internal override void ReportStartDrag(Canvas drawingCanvas, MouseButtonEventArgs args) { base.ReportStartDrag(drawingCanvas, args); if ((drawingCanvas == null) || (args.ChangedButton != MouseButton.Left)) { return; } Point mousePos = args.GetPosition(drawingCanvas); DDObject affectedObject = GetTopmostAtPointOfType(drawingCanvas, typeof(DDObject), mousePos) as DDObject; if (affectedObject == null) { SelectionRect = new DDSelectionRect(mousePos, mousePos); drawingCanvas.Children.Add(SelectionRect); } else { if ((TSFrame == null) || (!TSFrame.Targets.Contains(affectedObject))) { SelectObjects(drawingCanvas, affectedObject); } if (TSFrame != null) { DraggingPoint = new Point(mousePos.X - TSFrame.X, mousePos.Y - TSFrame.Y); } } }
internal override void ReportEndDrag(Canvas drawingCanvas, MouseButtonEventArgs args) { base.ReportEndDrag(drawingCanvas, args); if ((drawingCanvas == null) || (args.ChangedButton != MouseButton.Left)) { return; } DraggingPoint = null; if (SelectionRect != null) { SelectObjects(drawingCanvas, GetAllInsideRectOfDDObject(drawingCanvas, SelectionRect.Bounds)); drawingCanvas.Children.Remove(SelectionRect); SelectionRect = null; } }