private void thumbDragCompleted(SplitPositionBarViewModel barViewModel, SplitPositionItem item) { barViewModel.CheckAndRemoveBorderItem(item); this.Cursor = Cursors.Arrow; this.imageViewModel.ShowCursorLine = true; }
private void verticalBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int y = this.verticalPositionConverter.ConvertViewPositionToImagePosition(e.GetPosition(verticalBar).Y); if (0 < y && y < this.verticalPositionConverter.GetMaxImagePosition()) { SplitPositionItem item = new SplitPositionItem() { Position = y }; imageViewModel.VerticalSplitPositionBarViewModel.PositionList.Add(item); } }
private void horizontalBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int x = this.horizontalPositionConverter.ConvertViewPositionToImagePosition(e.GetPosition(horizontalBar).X); if (0 < x && x < this.horizontalPositionConverter.GetMaxImagePosition()) { SplitPositionItem item = new SplitPositionItem() { Position = x }; imageViewModel.HorizontalSplitPositionBarViewModel.PositionList.Add(item); } }
public void CheckAndRemoveBorderItem(SplitPositionItem item) { int pos = item.Position; if (pos <= MinPosition) { PositionList.Remove(item); } if (pos >= MaxPosition) { PositionList.Remove(item); } bool samePositionExists = (PositionList.Count((other) => { return (item != other && other.Position == pos); }) > 0); if (samePositionExists) { PositionList.Remove(item); } }
public void CheckAndRemoveBorderItem(SplitPositionItem item) { int pos = item.Position; if (pos <= MinPosition) { PositionList.Remove(item); } if (pos >= MaxPosition) { PositionList.Remove(item); } bool samePositionExists = (PositionList.Count((other) => { return(item != other && other.Position == pos); }) > 0); if (samePositionExists) { PositionList.Remove(item); } }
void positionItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName != "Position") { return; } SplitPositionItem item = (SplitPositionItem)sender; if (item.Position < MinPosition) { item.Position = MinPosition; } else if (item.Position > MaxPosition) { item.Position = MaxPosition; } OnAnyPositionChanged(); }
private void thumbDragDelta(SplitPositionItem item, ImagePositionConverter converter, double change) { item.Position += converter.ConvertViewPositionToImagePosition(change); }