Closed NKInstinct closed 3 years ago
Got it working!
This works as intended but for the polygon gate, a message is printed to the console with each click about how each group has only one observation. Wrapping the function in suppressMessages()
or suppressWarnings()
didn't help, and explicitly setting the group within aes(..., group = 1)
or outside as aes(...), group = 1
didn't help either. My guess is that this comes from how I'm having the reactive plot re-draw each time the polygon click is updated, so each time it draws that it has a moment where there's no groups in the data? I'm really not sure what's going on here but ultimately, it still works just fine so for now I'm just going to document it and mention that it's not a big deal in the vignette.
Completely re-factored the code to split out helper functions and write unit tests where possible. In the process, managed to get the polygon to draw without the warning printed by insisting that the code only attempt to draw a polygon if there are more than one point specified.
Would love to be able to see the polygon and quadrant gates when they are being drawn. Will likely need to add in a new layer that keeps updating the graph with some new geoms:
For quadrant, each time you click it should delete the old geom and then add a new hline and vline centered on the click
For polygon, the first click should add a geom_point layer to show where the click was. Each click thereafter should add a new geom_line that connects the new click the the preceding one.
Clicking clear in either case should remove the new geoms.
Note that for spans and rectangles, the fact that they are made by mouse sweeps rather than mouse clicks means this feature isn't needed for them.