Skip to content

Avoid readonly modifier in Crosshair's HLine and VLine #2208

@arthurits

Description

@arthurits

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 this

It seems that plottable Crosshair lines are readonly, preventing them to be modified (i.e. modifying their DragEnable property):

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions