-
Notifications
You must be signed in to change notification settings - Fork 981
Description
Feature Suggestion
Feature description: Avoid the readonly modifier in Crosshair public members HLine and VLine, to make them consistent with plottables HLine and VLine.
As shown in #2007, this is actually possible, resulting in lines which are directily user-draggable:
VLine1 = formsPlot1.Plot.AddVerticalLine(23, Color.Blue);
VLine1.DragEnabled = true;
HLine1 = formsPlot1.Plot.AddHorizontalLine(.2, Color.Green);
HLine1.DragEnabled = true;However, trying the same with plottable Crosshair doesn't seem to work:
var crossHair = this.formsPlot1.Plot.AddCrosshair(0, 0);
crossHair.VerticalLine.DragEnabled = true;
crossHair.HorizontalLine.DragEnabled = true; // still, both vertical and horizontal lines can't be user-dragged after thisIt seems that plottable Crosshair lines are readonly, preventing them to be modified (i.e. modifying their DragEnable property):
ScottPlot/src/ScottPlot4/ScottPlot/Plottable/Crosshair.cs
Lines 26 to 28 in 13f91b0
| public readonly HLine HorizontalLine = new(); | |
| public readonly VLine VerticalLine = new(); |
And plottables VLine and HLine are just public, so there's no problem modifying the DragEnable property:
| public VLine() : base(false) { } |
I don't know what are the reasons for that, but it could be a nice modification in order to make it possible for someone to implement snapping for Crosshair as suggested in #2007 and implemented in #2008 and #2017.