/// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);
            if (!this.IsZoomEnabled)
            {
                return;
            }

            this.PlotView.SetCursorType(CursorType.Default);
            this.PlotView.HideZoomRectangle();

            if (this.zoomRectangle.Width > 10 && this.zoomRectangle.Height > 10)
            {
                var p0 = this.InverseTransform(this.zoomRectangle.Left, this.zoomRectangle.Top);
                var p1 = this.InverseTransform(this.zoomRectangle.Right, this.zoomRectangle.Bottom);

                if (this.XAxis != null)
                {
                    this.XAxis.Zoom(p0.X, p1.X);
                }

                if (this.YAxis != null)
                {
                    this.YAxis.Zoom(p0.Y, p1.Y);
                }

                this.PlotView.InvalidatePlot();
            }

            e.Handled = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Handles mouse move events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseMove(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseMove(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                foreach (var m in this.MouseDownManipulators)
                {
                    m.Delta(args);
                }

                foreach (var m in this.MouseHoverManipulators)
                {
                    m.Delta(args);
                }

                return(args.Handled);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Delta(OxyMouseEventArgs e)
        {
            base.Delta(e);

            var plotArea = this.PlotView.ActualModel.PlotArea;

            double x = Math.Min(this.StartPosition.X, e.Position.X);
            double w = Math.Abs(this.StartPosition.X - e.Position.X);
            double y = Math.Min(this.StartPosition.Y, e.Position.Y);
            double h = Math.Abs(this.StartPosition.Y - e.Position.Y);

            if (this.XAxis == null || !this.XAxis.IsZoomEnabled)
            {
                x = plotArea.Left;
                w = plotArea.Width;
            }

            if (this.YAxis == null || !this.YAxis.IsZoomEnabled)
            {
                y = plotArea.Top;
                h = plotArea.Height;
            }

            this.zoomRectangle = new OxyRect(x, y, w, h);
            this.PlotView.ShowZoomRectangle(this.zoomRectangle);
        }
Esempio n. 4
0
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);
            if (!this.IsZoomEnabled)
            {
                return;
            }

            this.PlotView.SetCursorType(CursorType.Default);
            this.PlotView.HideZoomRectangle();

            if (this.zoomRectangle.Width > 10 && this.zoomRectangle.Height > 10)
            {
                var p0 = this.InverseTransform(this.zoomRectangle.Left, this.zoomRectangle.Top);
                var p1 = this.InverseTransform(this.zoomRectangle.Right, this.zoomRectangle.Bottom);

                if (this.XAxis != null)
                {
                    this.XAxis.Zoom(p0.X, p1.X);
                }

                if (this.YAxis != null)
                {
                    this.YAxis.Zoom(p0.Y, p1.Y);
                }

                this.PlotView.InvalidatePlot();
            }

            e.Handled = true;
        }
Esempio n. 5
0
        /// <summary>
        /// Occurs when an input device begins a manipulation on the plot.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Started(OxyMouseEventArgs e)
        {
            base.Started(e);
            this.currentSeries = this.PlotView.ActualModel != null?this.PlotView.ActualModel.GetSeriesFromPoint(e.Position) : null;

            this.Delta(e);
        }
        /// <summary>
        /// Handles the mouse down event.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="OxyPlot.OxyMouseEventArgs"/> instance containing the event data.
        /// </param>
        public void HandleMouseDown(object sender, OxyMouseEventArgs e)
        {
            // Revert the order to handle the top-level elements first
            foreach (var element in this.GetElements().Reverse())
            {
                var uiElement = element as UIPlotElement;
                if (uiElement == null)
                {
                    continue;
                }

                var result = uiElement.HitTest(e.Position, MouseHitTolerance);
                if (result != null)
                {
                    e.HitTestResult = result;
                    uiElement.OnMouseDown(sender, e);
                    if (e.Handled)
                    {
                        this.currentMouseEventElement = uiElement;
                    }
                }

                if (e.Handled)
                {
                    break;
                }
            }

            if (!e.Handled)
            {
                this.OnMouseDown(sender, e);
            }
        }
Esempio n. 7
0
 /// <summary>
 /// Raises the <see cref="MouseMove"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void OnMouseMove(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseMove != null)
     {
         this.MouseMove(sender, e);
     }
 }
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Delta(OxyMouseEventArgs e)
        {
            base.Delta(e);

            var plotArea = this.PlotView.ActualModel.PlotArea;

            double x = Math.Min(this.StartPosition.X, e.Position.X);
            double w = Math.Abs(this.StartPosition.X - e.Position.X);
            double y = Math.Min(this.StartPosition.Y, e.Position.Y);
            double h = Math.Abs(this.StartPosition.Y - e.Position.Y);

            if (this.XAxis == null || !this.XAxis.IsZoomEnabled)
            {
                x = plotArea.Left;
                w = plotArea.Width;
            }

            if (this.YAxis == null || !this.YAxis.IsZoomEnabled)
            {
                y = plotArea.Top;
                h = plotArea.Height;
            }

            this.zoomRectangle = new OxyRect(x, y, w, h);
            this.PlotView.ShowZoomRectangle(this.zoomRectangle);
        }
 /// <summary>
 /// Raises the <see cref="MouseMove"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected internal virtual void OnMouseMove(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseMove != null)
     {
         this.MouseMove(sender, e);
     }
 }
 /// <summary>
 /// Raises the <see cref="MouseUp"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected internal virtual void OnMouseUp(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseUp != null)
     {
         this.MouseUp(sender, e);
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Raises the <see cref="MouseDown"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void OnMouseDown(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseDown != null && !e.Handled)
     {
         this.MouseDown(sender, e);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Handles the mouse down event.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="OxyPlot.OxyMouseEventArgs"/> instance containing the event data.
        /// </param>
        public void HandleMouseDown(object sender, OxyMouseEventArgs e)
        {
            // Revert the order to handle the top-level elements first
            foreach (var element in this.GetElements().Reverse())
            {
                var uiElement = element as UIPlotElement;
                if (uiElement == null)
                {
                    continue;
                }

                var result = uiElement.HitTest(e.Position, MouseHitTolerance);
                if (result != null)
                {
                    e.HitTestResult = result;
                    uiElement.OnMouseDown(sender, e);
                    if (e.Handled)
                    {
                        this.currentMouseEventElement = uiElement;
                    }
                }

                if (e.Handled)
                {
                    break;
                }
            }

            if (!e.Handled)
            {
                this.OnMouseDown(sender, e);
            }
        }
 /// <summary>
 /// Handles the mouse leave event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
 public virtual void HandleMouseLeave(object sender, OxyMouseEventArgs e)
 {
     if (!e.Handled)
     {
         this.OnMouseLeave(sender, e);
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Raises the <see cref="MouseMove" /> event.
 /// </summary>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected internal virtual void OnMouseMove(OxyMouseEventArgs e)
 {
     var handler = this.MouseMove;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Esempio n. 15
0
 /// <summary>
 /// Adds the specified mouse hover manipulator and invokes the <see cref="MouseManipulator.Started" /> method with the specified mouse event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator.</param>
 /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 public virtual void AddHoverManipulator(
     IView view,
     ManipulatorBase <OxyMouseEventArgs> manipulator,
     OxyMouseEventArgs args)
 {
     this.MouseHoverManipulators.Add(manipulator);
     manipulator.Started(args);
 }
Esempio n. 16
0
 /// <summary>
 /// Raises the <see cref="MouseLeave" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnMouseLeave(object sender, OxyMouseEventArgs e)
 {
     var handler = this.MouseLeave;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
Esempio n. 17
0
        /// <summary>
        /// Zooms the view by the specified factor at the position specified in the <see cref="OxyMouseEventArgs" />.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
        /// <param name="delta">The zoom factor.</param>
        private static void HandleZoomAt(IPlotView view, OxyMouseEventArgs args, double delta)
        {
            var m = new ZoomStepManipulator(view)
            {
                Step = delta, FineControl = args.IsControlDown
            };

            m.Started(args);
        }
Esempio n. 18
0
        /// <summary>
        /// Raises the <see cref="MouseMove" /> event.
        /// </summary>
        /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        protected internal virtual void OnMouseMove(OxyMouseEventArgs e)
        {
            var handler = this.MouseMove;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);

            this.currentSeries = null;
            this.PlotView.HideTracker();
            if (this.PlotView.ActualModel != null)
            {
                this.PlotView.ActualModel.OnTrackerChanged(null);
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);

            this.currentSeries = null;
            this.PlotView.HideTracker();
            if (this.PlotView.ActualModel != null)
            {
                this.PlotView.ActualModel.OnTrackerChanged(null);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Handles the mouse move event.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="OxyPlot.OxyMouseEventArgs"/> instance containing the event data.
        /// </param>
        public void HandleMouseMove(object sender, OxyMouseEventArgs e)
        {
            if (this.currentMouseEventElement != null)
            {
                this.currentMouseEventElement.OnMouseMove(sender, e);
            }

            if (!e.Handled)
            {
                this.OnMouseMove(sender, e);
            }
        }
Esempio n. 22
0
        void plotModel_MouseUp(object sender, OxyPlot.OxyMouseEventArgs e)
        {
            if (DivergenceConvergencePlot.Series.Any(p => p.GetType() == typeof(OxyPlot.Wpf.LineSeries)))
            {
                //  int l = DivergenceConvergencePlot.Series.Count;
                var list = DivergenceConvergencePlot.Series.Where(p => p.GetType() != typeof(OxyPlot.Wpf.LineSeries)).ToList();

                DivergenceConvergencePlot.Series.Clear();
                list.ForEach(p => DivergenceConvergencePlot.Series.Add(p));

                DivergenceConvergencePlot.InvalidatePlot();
            }
        }
        /// <summary>
        /// Handles the mouse up event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public virtual void HandleMouseUp(object sender, OxyMouseEventArgs e)
        {
            if (this.currentMouseEventElement != null)
            {
                this.currentMouseEventElement.OnMouseUp(e);
                this.currentMouseEventElement = null;
            }

            if (!e.Handled)
            {
                this.OnMouseUp(sender, e);
            }
        }
        /// <summary>
        /// Occurs when an input device begins a manipulation on the plot.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Started(OxyMouseEventArgs e)
        {
            base.Started(e);

            this.IsZoomEnabled = (this.XAxis != null && this.XAxis.IsZoomEnabled) ||
                                 (this.YAxis != null && this.YAxis.IsZoomEnabled);

            if (this.IsZoomEnabled)
            {
                this.zoomRectangle = new OxyRect(this.StartPosition.X, this.StartPosition.Y, 0, 0);
                this.PlotView.ShowZoomRectangle(this.zoomRectangle);
                this.PlotView.SetCursorType(this.GetCursorType());
                e.Handled = true;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Handles mouse enter events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseEnter(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseEnter(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                var command = this.GetCommand(new OxyMouseEnterGesture(args.ModifierKeys));
                return(this.HandleCommand(command, view, args));
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Delta(OxyMouseEventArgs e)
        {
            base.Delta(e);

            if (this.currentSeries == null || !this.LockToInitialSeries)
            {
                // get the nearest
                this.currentSeries = this.PlotView.ActualModel != null?this.PlotView.ActualModel.GetSeriesFromPoint(e.Position, 20) : null;
            }

            if (this.currentSeries == null)
            {
                if (!this.LockToInitialSeries)
                {
                    this.PlotView.HideTracker();
                }

                return;
            }

            var actualModel = this.PlotView.ActualModel;

            if (actualModel == null)
            {
                return;
            }

            if (!actualModel.PlotArea.Contains(e.Position.X, e.Position.Y))
            {
                return;
            }

            var result = GetNearestHit(this.currentSeries, e.Position, this.Snap, this.PointsOnly);

            if (result != null)
            {
                result.PlotModel = this.PlotView.ActualModel;
                this.PlotView.ShowTracker(result);
                this.PlotView.ActualModel.OnTrackerChanged(result);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Handles mouse up events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseUp(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseUp(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                foreach (var m in this.MouseDownManipulators.ToArray())
                {
                    m.Completed(args);
                    this.MouseDownManipulators.Remove(m);
                }

                return(args.Handled);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Delta(OxyMouseEventArgs e)
        {
            base.Delta(e);

            if (this.currentSeries == null || !this.LockToInitialSeries)
            {
                // get the nearest
                this.currentSeries = this.PlotView.ActualModel != null ? this.PlotView.ActualModel.GetSeriesFromPoint(e.Position, 20) : null;
            }

            if (this.currentSeries == null)
            {
                if (!this.LockToInitialSeries)
                {
                    this.PlotView.HideTracker();
                }

                return;
            }

            var actualModel = this.PlotView.ActualModel;
            if (actualModel == null)
            {
                return;
            }

            if (!actualModel.PlotArea.Contains(e.Position.X, e.Position.Y))
            {
                return;
            }

            var result = GetNearestHit(this.currentSeries, e.Position, this.Snap, this.PointsOnly);
            if (result != null)
            {
                result.PlotModel = this.PlotView.ActualModel;
                this.PlotView.ShowTracker(result);
                this.PlotView.ActualModel.OnTrackerChanged(result);
            }
        }
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);

            this.PlotView.HideZoomRectangle();

            if (this.zoomRectangle.Width > 10 && this.zoomRectangle.Height > 10)
            {
                var p0 = this.InverseTransform(this.zoomRectangle.Left, this.zoomRectangle.Top);
                var p1 = this.InverseTransform(this.zoomRectangle.Right, this.zoomRectangle.Bottom);

                if (this.XAxis != null)
                {
                    this.XAxis.Zoom(p0.X, p1.X);
                }

                if (this.YAxis != null)
                {
                    this.YAxis.Zoom(p0.Y, p1.Y);
                }

                this.PlotView.InvalidatePlot();
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Completed(OxyMouseEventArgs e)
        {
            base.Completed(e);

            this.PlotView.HideZoomRectangle();

            if (this.zoomRectangle.Width > 10 && this.zoomRectangle.Height > 10)
            {
                var p0 = this.InverseTransform(this.zoomRectangle.Left, this.zoomRectangle.Top);
                var p1 = this.InverseTransform(this.zoomRectangle.Right, this.zoomRectangle.Bottom);

                if (this.XAxis != null)
                {
                    this.XAxis.Zoom(p0.X, p1.X);
                }

                if (this.YAxis != null)
                {
                    this.YAxis.Zoom(p0.Y, p1.Y);
                }

                this.PlotView.InvalidatePlot();
            }
        }
Esempio n. 31
0
 /// <summary>
 /// Zooms the view by the specified factor at the position specified in the <see cref="OxyMouseEventArgs" />.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor.</param>
 private static void HandleZoomAt(IPlotView view, OxyMouseEventArgs args, double delta)
 {
     var m = new ZoomStepManipulator(view) { Step = delta, FineControl = args.IsControlDown };
     m.Started(args);
 }
Esempio n. 32
0
File: Model.cs Progetto: edems/Burn
 private void plotModel_Mouseup(object sender, OxyMouseEventArgs e)
 {
     if (addPointbool == false)
     {
         indexOfPointToMove = -1;
         kurbelwelle.LineStyle = LineStyle.Solid;
     }
 }
Esempio n. 33
0
File: Model.cs Progetto: edems/Burn
 private void plotModel_MouseMove(object sender, OxyMouseEventArgs e)
 {
     try
     {
         if (addPointbool == false)
         {
             if (indexOfPointToMove >= 0)
             {
                 // Move the point being edited.
                 kurbelwelle.Points[indexOfPointToMove] = kurbelwelle.InverseTransform(e.Position);
                 PlotModel.RefreshPlot(true);
             }
         }
     }
     catch { }
 }
Esempio n. 34
0
        /// <summary>
        /// Handles the mouse up event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public virtual void HandleMouseUp(object sender, OxyMouseEventArgs e)
        {
            if (this.currentMouseEventElement != null)
            {
                this.currentMouseEventElement.OnMouseUp(e);
                this.currentMouseEventElement = null;
            }

            if (!e.Handled)
            {
                this.OnMouseUp(sender, e);
            }
        }
Esempio n. 35
0
        /// <summary>
        /// Handles mouse enter events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseEnter(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseEnter(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                var command = this.GetCommand(new OxyMouseEnterGesture(args.ModifierKeys));
                return this.HandleCommand(command, view, args);
            }
        }
Esempio n. 36
0
 /// <summary>Mouse up event on chart. If in a right click, display the popup menu.</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnChartMouseUp(object sender, OxyMouseEventArgs e)
 {
     e.Handled = false;
     if (inRightClick)
         Popup.Popup();
     inRightClick = false;
 }
Esempio n. 37
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
 public override void Started(OxyMouseEventArgs e)
 {
     base.Started(e);
     this.zoomRectangle = new OxyRect(this.StartPosition.X, this.StartPosition.Y, 0, 0);
     this.PlotView.ShowZoomRectangle(this.zoomRectangle);
 }
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
 public override void Started(OxyMouseEventArgs e)
 {
     base.Started(e);
     this.zoomRectangle = new OxyRect(this.StartPosition.X, this.StartPosition.Y, 0, 0);
     this.PlotView.ShowZoomRectangle(this.zoomRectangle);
 }
Esempio n. 39
0
 /// <summary>
 /// Raises the <see cref="MouseLeave" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnMouseLeave(object sender, OxyMouseEventArgs e)
 {
     var handler = this.MouseLeave;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
Esempio n. 40
0
        private void Model_MouseMove(object sender, OxyMouseEventArgs e)
        {
            //if (e.ChangedButton == OxyMouseButton.Left)
            {
                if (!m_movingMouse)
                    return;

                var point = FindPoint(e.Position);
                if (PointClicked != null)
                    PointClicked(this, new PositionArgs(point.X, point.Y));
                ScanAnnotationX = point.X;
            }
        }
Esempio n. 41
0
 private void Model_MouseUp(object sender, OxyMouseEventArgs e)
 {
     //if (e == OxyMouseButton.Left)
     {
         m_movingMouse = false;
     }
 }
Esempio n. 42
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
 public override void Started(OxyMouseEventArgs e)
 {
     base.Started(e);
     this.currentSeries = this.PlotView.ActualModel != null ? this.PlotView.ActualModel.GetSeriesFromPoint(e.Position) : null;
     this.Delta(e);
 }
 /// <summary>
 /// Raises the <see cref="MouseDown"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void OnMouseDown(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseDown != null && !e.Handled)
     {
         this.MouseDown(sender, e);
     }
 }
Esempio n. 44
0
        /// <summary>
        /// Handles mouse up events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseUp(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseUp(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                foreach (var m in this.MouseDownManipulators.ToArray())
                {
                    m.Completed(args);
                    this.MouseDownManipulators.Remove(m);
                }

                return args.Handled;
            }
        }
        /// <summary>
        /// Handles the mouse move event.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="OxyPlot.OxyMouseEventArgs"/> instance containing the event data.
        /// </param>
        public void HandleMouseMove(object sender, OxyMouseEventArgs e)
        {
            if (this.currentMouseEventElement != null)
            {
                this.currentMouseEventElement.OnMouseMove(sender, e);
            }

            if (!e.Handled)
            {
                this.OnMouseMove(sender, e);
            }
        }
Esempio n. 46
0
        /// <summary>
        /// Occurs when an input device begins a manipulation on the plot.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public override void Started(OxyMouseEventArgs e)
        {
            base.Started(e);

            this.IsZoomEnabled = (this.XAxis != null && this.XAxis.IsZoomEnabled)
                     || (this.YAxis != null && this.YAxis.IsZoomEnabled);

            if (this.IsZoomEnabled)
            {
                this.zoomRectangle = new OxyRect(this.StartPosition.X, this.StartPosition.Y, 0, 0);
                this.PlotView.ShowZoomRectangle(this.zoomRectangle);
                this.PlotView.SetCursorType(this.GetCursorType());
                e.Handled = true;
            }
        }
Esempio n. 47
0
 /// <summary>Mouse has moved on the chart.
 /// If the user was just dragging the chart, we won't want to 
 /// display the popup menu when the mouse is released</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnChartMouseMove(object sender, OxyMouseEventArgs e)
 {
     e.Handled = false;
     inRightClick = false;
 }
 /// <summary>
 /// Raises the <see cref="MouseUp"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The <see cref="OxyMouseEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void OnMouseUp(object sender, OxyMouseEventArgs e)
 {
     if (this.MouseUp != null)
     {
         this.MouseUp(sender, e);
     }
 }
Esempio n. 49
0
        /// <summary>
        /// Handles mouse move events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseMove(IView view, OxyMouseEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseMove(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                foreach (var m in this.MouseDownManipulators)
                {
                    m.Delta(args);
                }

                foreach (var m in this.MouseHoverManipulators)
                {
                    m.Delta(args);
                }

                return args.Handled;
            }
        }
Esempio n. 50
0
 /// <summary>
 /// Handles the mouse leave event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
 public virtual void HandleMouseLeave(object sender, OxyMouseEventArgs e)
 {
     if (!e.Handled)
     {
         this.OnMouseLeave(sender, e);
     }
 }
Esempio n. 51
0
 /// <summary>
 /// Adds the specified mouse hover manipulator and invokes the <see cref="MouseManipulator.Started" /> method with the specified mouse event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator.</param>
 /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 public virtual void AddHoverManipulator(
     IView view,
     ManipulatorBase<OxyMouseEventArgs> manipulator,
     OxyMouseEventArgs args)
 {
     this.MouseHoverManipulators.Add(manipulator);
     manipulator.Started(args);
 }
        private void MouseButtonDown(object sender, OxyMouseEventArgs e)
        {
            var plot = ObservedIsoPlot;

            if (e.ChangedButton == OxyMouseButton.Left)
            {
                var position = e.Position;

                var series = plot.GetSeriesFromPoint(position, 10);
                if (series != null)
                {
                    var hitResult = series.GetNearestPoint(position, true);

                    if (hitResult != null && hitResult.DataPoint != null)
                    {
                        var datapoint = hitResult.DataPoint;

                        SelectedPeak = new Peak(datapoint.X, (float)datapoint.Y, 0);

                        GeneralStatusMessage = "Selected point = " + datapoint.X.ToString("0.000") + ", " +
                                       datapoint.Y.ToString("0.000");
                    }
                }
            }
        }