예제 #1
0
        public void MouseClicked(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Controls.Image image = (System.Windows.Controls.Image)sender;

            System.Windows.Point point = e.GetPosition(image);

            double xRatio = point.X / image.ActualWidth;
            double yRatio = point.Y / image.ActualHeight;

            AddUndoAction(SelectedWhiskerPoint.Clone());

            SelectedWhiskerPoint.XRatio = xRatio;
            SelectedWhiskerPoint.YRatio = yRatio;

            SelectedWhiskerPoint.CanvasWidth  = image.ActualWidth;
            SelectedWhiskerPoint.CanvasHeight = image.ActualHeight;

            NotifyPropertyChanged("Whiskers");
            ExportCommand.RaiseCanExecuteChangedNotification();

            if (AutoNextPoint)
            {
                IncreaseWhiskerCounter();
            }
        }
예제 #2
0
        private void RepeatLastPoint()
        {
            //Make sure there's a previous frame to repeat action from
            if (CurrentFrame == null || m_Frames == null)
            {
                return;
            }

            if (m_Frames.Count <= 1)
            {
                return;
            }

            if (FrameCounter == 0)
            {
                return;
            }

            MouseFrameViewModel lastFrame = m_Frames[FrameCounter - 1];

            WhiskerViewModel previousWhisker = lastFrame.Whiskers.FirstOrDefault(x => x.WhiskerId == SelectedWhisker.WhiskerId);

            if (previousWhisker == null)
            {
                return;
            }

            WhiskerPointViewModel previousPoint = previousWhisker.WhiskerPoints.FirstOrDefault(x => x.PointId == SelectedWhiskerPoint.PointId);

            if (previousPoint == null)
            {
                return;
            }

            AddUndoAction(SelectedWhiskerPoint.Clone());

            SelectedWhiskerPoint.XRatio = previousPoint.XRatio;
            SelectedWhiskerPoint.YRatio = previousPoint.YRatio;

            SelectedWhiskerPoint.CanvasWidth  = previousPoint.CanvasWidth;
            SelectedWhiskerPoint.CanvasHeight = previousPoint.CanvasHeight;

            NotifyPropertyChanged("Whiskers");

            if (AutoNextPoint)
            {
                IncreaseWhiskerCounter();
            }
        }