diff --git a/Source/Examples/ExampleLibrary/Annotations/EllipseAnnotationExamples.cs b/Source/Examples/ExampleLibrary/Annotations/EllipseAnnotationExamples.cs index 2b50274..ce93b6c 100644 --- a/Source/Examples/ExampleLibrary/Annotations/EllipseAnnotationExamples.cs +++ b/Source/Examples/ExampleLibrary/Annotations/EllipseAnnotationExamples.cs @@ -19,53 +19,11 @@ public static PlotModel EllipseAnnotation() var model = new PlotModel { Title = "EllipseAnnotation" }; model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left }); - model.Annotations.Add(new EllipseAnnotation - { - X = 20, - Y = 60, - Width = 20, - Height = 15, - Text = "EllipseAnnotation", - ToolTip = "EllipseAnnotation", - TextRotation = 10, - Fill = OxyColor.FromAColor(99, OxyColors.Green), - Stroke = OxyColors.Black, - StrokeThickness = 2 - }); + 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 }); - model.Annotations.Add(new EllipseAnnotation - { - X = 20, - Y = 20, - Width = 20, - Height = 20, - Fill = OxyColor.FromAColor(99, OxyColors.Green), - ToolTip = "Green", - Stroke = OxyColors.Black, - StrokeThickness = 2 - }); - model.Annotations.Add(new EllipseAnnotation - { - X = 30, - Y = 20, - Width = 20, - Height = 20, - Fill = OxyColor.FromAColor(99, OxyColors.Red), - ToolTip = "Red", - Stroke = OxyColors.Black, - StrokeThickness = 2 - }); - model.Annotations.Add(new EllipseAnnotation - { - X = 25, - Y = 30, - Width = 20, - Height = 20, - Fill = OxyColor.FromAColor(99, OxyColors.Blue), - ToolTip = "Blue", - Stroke = OxyColors.Black, - StrokeThickness = 2 - }); + model.Annotations.Add(new EllipseAnnotation { X = 20, Y = 20, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Green), Stroke = OxyColors.Black, StrokeThickness = 2 }); + model.Annotations.Add(new EllipseAnnotation { X = 30, Y = 20, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Red), Stroke = OxyColors.Black, StrokeThickness = 2 }); + model.Annotations.Add(new EllipseAnnotation { X = 25, Y = 30, Width = 20, Height = 20, Fill = OxyColor.FromAColor(99, OxyColors.Blue), Stroke = OxyColors.Black, StrokeThickness = 2 }); return model; } } diff --git a/Source/Examples/ExampleLibrary/Example.cs b/Source/Examples/ExampleLibrary/Example.cs index 54cd770..26c3fdc 100644 --- a/Source/Examples/ExampleLibrary/Example.cs +++ b/Source/Examples/ExampleLibrary/Example.cs @@ -30,7 +30,7 @@ public Example(PlotModel model, IPlotController controller = null) /// /// The controller. /// - public IPlotController Controller { get; set; } + public IPlotController Controller { get; private set; } /// /// Gets the model. diff --git a/Source/Examples/ExampleLibrary/ExampleInfo.cs b/Source/Examples/ExampleLibrary/ExampleInfo.cs index d289734..15c694f 100644 --- a/Source/Examples/ExampleLibrary/ExampleInfo.cs +++ b/Source/Examples/ExampleLibrary/ExampleInfo.cs @@ -32,7 +32,7 @@ public class ExampleInfo /// /// The un-modified example. /// - public Example Example { get; private set; } + private Example Example; /// /// The examples for this example info. diff --git a/Source/OxyplotMauiSample/Pages/ExampleBrowser.xaml.cs b/Source/OxyplotMauiSample/Pages/ExampleBrowser.xaml.cs index bdc5848..dd6c907 100644 --- a/Source/OxyplotMauiSample/Pages/ExampleBrowser.xaml.cs +++ b/Source/OxyplotMauiSample/Pages/ExampleBrowser.xaml.cs @@ -1,9 +1,6 @@ using ExampleLibrary; using System.Collections.ObjectModel; using System.Windows.Input; -using OxyPlot; -using OxyPlot.Maui.Skia; -using OxyPlot.Maui.Skia.Core; namespace OxyplotMauiSample { @@ -32,46 +29,14 @@ private async void ListView_OnItemSelected(object sender, SelectedItemChangedEve return; var exampleInfo = e.SelectedItem as ExampleInfo; - if (exampleInfo == null) - return; - var page = new PlotViewPage { ExampleInfo = exampleInfo }; - - // try add tracker support for annotations - if (exampleInfo.Tags.Contains("Annotations") && exampleInfo.PlotController == null) - { - exampleInfo.Example.Controller = CreateAnnotationTrackController(); - } await Navigation.PushAsync(page); LvExamples.SelectedItem = null; } - - private IPlotController CreateAnnotationTrackController() - { - var controller = new OxyPlot.Maui.Skia.PlotController(); - controller.UnbindTouchDown(); - - var snapTrackTouch = new DelegatePlotCommand((view, c, args) => - c.AddTouchManipulator(view, new OxyPlot.Maui.Skia.Manipulators.TouchTrackerManipulator(view) - { - Snap = true, - PointsOnly = true, - LockToInitialSeries = false, - IsTrackAnnotations = true - }, args)); - - var cmd = new CompositeDelegateViewCommand( - snapTrackTouch, - OxyPlot.Maui.Skia.PlotCommands.PanZoomByTouch - ); - controller.BindTouchDown(cmd); - - return controller; - } } public class ExampleBrowserViewModel : ViewModelBase