コード例 #1
0
        private void Chart_PreviewMouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            var transform = Plotter.Viewport.Transform;
            System.Windows.Point mousePos = mouseTrack.Position;
            mouseScreenPosition = Mouse.GetPosition(Plotter.CentralGrid);
            //System.Diagnostics.Debug.WriteLine("Start: " + mouseScreenPosition);
            var mousePositionInData = mouseScreenPosition.ScreenToData(transform);
            var screenPos = mousePositionInData.DataToScreen(transform);

            //System.Diagnostics.Debug.WriteLine(mousePositionInData);
            if (IsShiftPressed()) //make note
            {
                xValue = mousePositionInData.X;
                yValue = mousePositionInData.Y;
                String note = MakeNote();
                if (note != "")
                {
                    NoteTable.Add(xValue, note);
                }
            }
            else if (IsControlPressed())
            {

            }
            else if (IsAltPressed()) // change window zoom
            {
                if (ZoomedIn)
                {
                    ZoomOut();
                    ZoomedIn = false;
                }
                else
                {
                    xValue = mousePositionInData.X;
                    yValue = mousePositionInData.Y;
                    xMinWindowWhenZoomed = xValue - 50;
                    yMinWindowWhenZoomed = yValue - 50;
                    ZoomIn(xValue, yValue);
                    ZoomedIn = true;
                }
            }
            else //normal left click sync videos to click location
            {
                if (ZoomedIn)
                {
                    xValue = mousePositionInData.X;
                    yValue = mousePositionInData.Y;
                }
                else
                {
                    xValue = mousePositionInData.X;
                    yValue = mousePositionInData.Y;
                }

                //System.Diagnostics.Debug.WriteLine("int: " + (int)xValue);
                TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)(xValue * 1000));
                RightChangePosition(ts);
                LeftChangePosition(ts);
            }
        }