Skip to content

Commit 750cbcf

Browse files
committed
Revert "add tool tip support for annotations"
* this (partially) reverts commit 39b6141 * except for the changes in OxyPlot.Maui.Skia/Manipulators/TouchTrackerManipulator.cs, which are kept
1 parent f0a6d8b commit 750cbcf

File tree

4 files changed

+6
-83
lines changed

4 files changed

+6
-83
lines changed

Source/Examples/ExampleLibrary/Annotations/EllipseAnnotationExamples.cs

+4-46
Original file line numberDiff line numberDiff line change
@@ -19,53 +19,11 @@ public static PlotModel EllipseAnnotation()
1919
var model = new PlotModel { Title = "EllipseAnnotation" };
2020
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
2121
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
22-
model.Annotations.Add(new EllipseAnnotation
23-
{
24-
X = 20,
25-
Y = 60,
26-
Width = 20,
27-
Height = 15,
28-
Text = "EllipseAnnotation",
29-
ToolTip = "EllipseAnnotation",
30-
TextRotation = 10,
31-
Fill = OxyColor.FromAColor(99, OxyColors.Green),
32-
Stroke = OxyColors.Black,
33-
StrokeThickness = 2
34-
});
22+
model.Annotations.Add(new EllipseAnnotation { X = 20, Y = 60, Width = 20, Height = 15, Text = "EllipseAnnotation", TextRotation = 10, Fill = OxyColor.FromAColor(99, OxyColors.Green), Stroke = OxyColors.Black, StrokeThickness = 2 });
3523

36-
model.Annotations.Add(new EllipseAnnotation
37-
{
38-
X = 20,
39-
Y = 20,
40-
Width = 20,
41-
Height = 20,
42-
Fill = OxyColor.FromAColor(99, OxyColors.Green),
43-
ToolTip = "Green",
44-
Stroke = OxyColors.Black,
45-
StrokeThickness = 2
46-
});
47-
model.Annotations.Add(new EllipseAnnotation
48-
{
49-
X = 30,
50-
Y = 20,
51-
Width = 20,
52-
Height = 20,
53-
Fill = OxyColor.FromAColor(99, OxyColors.Red),
54-
ToolTip = "Red",
55-
Stroke = OxyColors.Black,
56-
StrokeThickness = 2
57-
});
58-
model.Annotations.Add(new EllipseAnnotation
59-
{
60-
X = 25,
61-
Y = 30,
62-
Width = 20,
63-
Height = 20,
64-
Fill = OxyColor.FromAColor(99, OxyColors.Blue),
65-
ToolTip = "Blue",
66-
Stroke = OxyColors.Black,
67-
StrokeThickness = 2
68-
});
24+
model.Annotations.Add(new EllipseAnnotation { X = 20, Y = 20, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Green), Stroke = OxyColors.Black, StrokeThickness = 2 });
25+
model.Annotations.Add(new EllipseAnnotation { X = 30, Y = 20, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Red), Stroke = OxyColors.Black, StrokeThickness = 2 });
26+
model.Annotations.Add(new EllipseAnnotation { X = 25, Y = 30, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Blue), Stroke = OxyColors.Black, StrokeThickness = 2 });
6927
return model;
7028
}
7129
}

Source/Examples/ExampleLibrary/Example.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public Example(PlotModel model, IPlotController controller = null)
3030
/// <value>
3131
/// The controller.
3232
/// </value>
33-
public IPlotController Controller { get; set; }
33+
public IPlotController Controller { get; private set; }
3434

3535
/// <summary>
3636
/// Gets the model.

Source/Examples/ExampleLibrary/ExampleInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ExampleInfo
3232
/// <summary>
3333
/// The un-modified example.
3434
/// </summary>
35-
public Example Example { get; private set; }
35+
private Example Example;
3636

3737
/// <summary>
3838
/// The examples for this example info.

Source/OxyplotMauiSample/Pages/ExampleBrowser.xaml.cs

-35
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using ExampleLibrary;
22
using System.Collections.ObjectModel;
33
using System.Windows.Input;
4-
using OxyPlot;
5-
using OxyPlot.Maui.Skia;
6-
using OxyPlot.Maui.Skia.Core;
74

85
namespace OxyplotMauiSample
96
{
@@ -32,46 +29,14 @@ private async void ListView_OnItemSelected(object sender, SelectedItemChangedEve
3229
return;
3330

3431
var exampleInfo = e.SelectedItem as ExampleInfo;
35-
if (exampleInfo == null)
36-
return;
37-
3832
var page = new PlotViewPage
3933
{
4034
ExampleInfo = exampleInfo
4135
};
42-
43-
// try add tracker support for annotations
44-
if (exampleInfo.Tags.Contains("Annotations") && exampleInfo.PlotController == null)
45-
{
46-
exampleInfo.Example.Controller = CreateAnnotationTrackController();
47-
}
4836
await Navigation.PushAsync(page);
4937

5038
LvExamples.SelectedItem = null;
5139
}
52-
53-
private IPlotController CreateAnnotationTrackController()
54-
{
55-
var controller = new OxyPlot.Maui.Skia.PlotController();
56-
controller.UnbindTouchDown();
57-
58-
var snapTrackTouch = new DelegatePlotCommand<OxyTouchEventArgs>((view, c, args) =>
59-
c.AddTouchManipulator(view, new OxyPlot.Maui.Skia.Manipulators.TouchTrackerManipulator(view)
60-
{
61-
Snap = true,
62-
PointsOnly = true,
63-
LockToInitialSeries = false,
64-
IsTrackAnnotations = true
65-
}, args));
66-
67-
var cmd = new CompositeDelegateViewCommand<OxyTouchEventArgs>(
68-
snapTrackTouch,
69-
OxyPlot.Maui.Skia.PlotCommands.PanZoomByTouch
70-
);
71-
controller.BindTouchDown(cmd);
72-
73-
return controller;
74-
}
7540
}
7641

7742
public class ExampleBrowserViewModel : ViewModelBase

0 commit comments

Comments
 (0)