-
Notifications
You must be signed in to change notification settings - Fork 981
Description
Bug Report
Issue: ScatterPlotDraggable.IsUnderMouse method crashes after calling ScatterPlotDraggable.Update method
Reproducing:
Calling ScatterPlotDraggable.Update method with a new pair of Xs and Ys arrays, "larger" than the existing ones, then waiting for any event that is triggering ScatterPlotDraggable.IsUnderMouse method (i.e. a mouse down event) will eventually crash. Because in ScatterPlotDraggable, Xs and Ys are defined as NEW double arrays, IsUnderMouse references to them, however ScatterPlot.Update() method updates the other Xs and Ys arrays in the base class.
myScatterPlotDraggable.Update(newXsWithLargerSize, newYsWithLargerSize);
// make a mouse interactionI found a solution by removing Xs and Ys properties from ScatterPlotDraggable, and changing the relevant set accessors in ScatterPlot class to "protected set"
In ScatterPlotDraggable.cs:
//public new double[] Xs { get; private set; }
//public new double[] Ys { get; private set; }In ScatterPlot.cs:
public double[] Xs { get; protected set; }
public double[] Ys { get; protected set; }But I'm not sure if there is a side effect to doing it like this.
System Details
- ScottPlot Version: 4.1.65.0
- Operating System: Windows 11
- Application Type: WPF
- .NET Version: .NET 7.0