Conversation
- `Text` now supports `IDraggable` interface - `RectangleUnits` should hold the bounding box rectangle around the text in unit dimensions - The `DeltaCX` and `DeltaCY` properties are used to hold the offset between the reference corner of the bounding box and the actual position of the mouse so that the Text does not *jump* during drag - The current `isUnderMouse` test using `RectangleF.Contains` fails though the coordinates are actually inside the rechangle. Any ideas @swharden ?
|
@BambOoxX thank you so much for identifying and fixing the error Note that I'm working toward a soft feature freeze #1624 to let me focus on some deep refactoring of this library (namely #1036), but that I'll do my best to devote good time to this PR and the other existing open issues over the next few days. Thanks again for all your work on this! 👍 |
Since ScottPlot 5 will not use GDI or System.Drawing (#1036) I was motivated to figure-out how to implement hit detection on arbitrary rotated rectangles.
It sounds like I may have duplicate some of your work here, but I made a little test application to demonstrate the effect ... I'll put this down for the night, but work on this PR more tomorrow 👍 |
swapped Y values for top and bottom
|
After hours of debugging I figured-out the problem was because the coordinate rectangle had a negative height. Swapping the Y values used for the top and bottom of the rectangle fixed the problem, and draggable functionality worked beautifully. Thanks again for all your help on this @BambOoxX! I even got a blog post out of the deal 😎 https://swharden.com/blog/2022-02-01-point-in-rectangle/ |
|
@swharden Nice work finding the bug ! I saw the triangle surface method, but I think the scalar projection method is much more elegant. Of course for a single rectangle that should not make much difference, but this way you only compute 3 distances and at most 4 scalar products. I will try to implement this when I get some time. |

This PR implements drag functionality for
Textplottables.The current
isUnderMousetest fails, but that seems internal to GDI.Another implementation, not pushed though, works fine using this test

https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle
This PR also contains a patch forEDIT: moved to #1625/#1626GetCoordinateYin 650f60e