protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); if (isSelected) { isSelected = false; } if (Core.IsDragging) { if (isDragging) { onMouseUpTimestamp = e.Timestamp & Int32.MaxValue; isDragging = false; Debug.WriteLine("IsDragging = " + isDragging); Cursor = cursorBefore; Mouse.Capture(null); } Core.EndDrag(); if (BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position)) { if (Core.LastLocationInBounds.HasValue) { Position = Core.LastLocationInBounds.Value; } } } else { if (e.ChangedButton == DragButton) { Core.mouseDown = GPoint.Empty; } if (!selectionEnd.IsEmpty && !selectionStart.IsEmpty) { bool zoomtofit = false; if (!SelectedArea.IsEmpty && Keyboard.Modifiers == ModifierKeys.Shift) { zoomtofit = SetZoomToFitRect(SelectedArea); } OnSelectionChange?.Invoke(SelectedArea, zoomtofit); } else { InvalidateVisual(); } } }