Disabling Nuvoton NCT6791D because of fan full speed bug on Asus Z97 WS.
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="TrackerManipulator.cs" company="OxyPlot">
3 // The MIT License (MIT)
5 // Copyright (c) 2012 Oystein Bjorke
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the
9 // "Software"), to deal in the Software without restriction, including
10 // without limitation the rights to use, copy, modify, merge, publish,
11 // distribute, sublicense, and/or sell copies of the Software, and to
12 // permit persons to whom the Software is furnished to do so, subject to
13 // the following conditions:
15 // The above copyright notice and this permission notice shall be included
16 // in all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 // The tracker manipulator.
29 // --------------------------------------------------------------------------------------------------------------------
35 /// Provides a plot control manipulator for tracker functionality.
37 public class TrackerManipulator : ManipulatorBase
40 /// The current series.
42 private ITrackableSeries currentSeries;
45 /// Initializes a new instance of the <see cref="TrackerManipulator"/> class.
47 /// <param name="plotControl">
50 public TrackerManipulator(IPlotControl plotControl)
54 this.PointsOnly = false;
58 /// Gets or sets a value indicating whether to show tracker on points only (not interpolating).
60 public bool PointsOnly { get; set; }
63 /// Gets or sets a value indicating whether to snap to the nearest point.
65 public bool Snap { get; set; }
68 /// Occurs when a manipulation is complete.
71 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
73 public override void Completed(ManipulationEventArgs e)
77 if (this.currentSeries == null)
82 this.currentSeries = null;
83 this.PlotControl.HideTracker();
87 /// Occurs when the input device changes position during a manipulation.
90 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
92 public override void Delta(ManipulationEventArgs e)
95 if (this.currentSeries == null)
100 if (!this.PlotControl.ActualModel.PlotArea.Contains(e.CurrentPosition.X, e.CurrentPosition.Y))
105 TrackerHitResult result = GetNearestHit(this.currentSeries, e.CurrentPosition, this.Snap, this.PointsOnly);
108 result.PlotModel = this.PlotControl.ActualModel;
109 this.PlotControl.ShowTracker(result);
114 /// Gets the cursor for the manipulation.
119 public override CursorType GetCursorType()
121 return CursorType.Default;
125 /// Occurs when an input device begins a manipulation on the plot.
128 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
130 public override void Started(ManipulationEventArgs e)
133 this.currentSeries = this.PlotControl.GetSeriesFromPoint(e.CurrentPosition);
138 /// Gets the nearest tracker hit.
143 /// <param name="point">
146 /// <param name="snap">
149 /// <param name="pointsOnly">
150 /// Check points only (no interpolation).
153 /// A tracker hit result.
155 private static TrackerHitResult GetNearestHit(ITrackableSeries s, ScreenPoint point, bool snap, bool pointsOnly)
162 // Check data points only
163 if (snap || pointsOnly)
165 TrackerHitResult result = s.GetNearestPoint(point, false);
168 if (result.Position.DistanceTo(point) < 20)
175 // Check between data points (if possible)
178 TrackerHitResult result = s.GetNearestPoint(point, true);