Conversation
|
Hi @swharden, I looked at your work and want to leave a few comments.
public interface IHittable
{
bool ClickEnabled {get; set};
//or
bool HitTestEnabled{get;set;}
...
}
public bool HitTest(Coords c, PlotDimensions dims);
public IPlottable GetHittable(double xPixel, double yPixel)
{
return GetPlottables()
.Where(x => x is IHittable)
.Reverse())
.FirstOrDefault( p =>
{
double xCoords = GetCoordinateX((float)xPixel, p.XAxisIndex);
double yCoords = GetCoordinateY((float)yPixel, p.YAxisIndex);
Coordinate c = new(xCoords, yCoords);
return (IHittable)p.HitTest(c);
});
} |
|
Hi @StendProg, thank you for your feedback! I really value your input. I found this problem to be surprisingly difficult, and it I put it down for a few days and am now coming back to it. 1. Do hittable plottables require unique cursors?I think so. Here are some potential use cases. 2. HitTestEnabledpublic interface IHittable
{
bool HitTestEnabled { get; set; }
...
}Great suggestion! I will implement this. 3&4. Instead of storing state, can you pass
|



This PR creates an
IHittableinterface that plottable objects can implement so when they are clicked the control'sOnLeftClickedPlottableevent is fired. resolves #1844