disorderedmaterials / plot

Testing / proving ground for Qt3D 2D/3D plotting
0 stars 0 forks source link

Mouse coordinates #48

Closed jswift-stfc closed 2 years ago

jswift-stfc commented 2 years ago

It could be a good idea to display somewhere the cartesian coordinates of the mouse in the frame, i.e. show the current "value" that the mouse is hovered on?

trisyoungs commented 2 years ago

Yes, but I think it would be wise to provide a couple of different options for this:

1) Display in an external widget - this requires us to offer a signal containing the 2D coordinate of the mouse, and it's up to the developer to provide a widget and connect up to the signal. 2) Display within our widget - we can display the 2D coordinates on our own widget, at one corner of the display. 3) Display near to the mouse pointer - we can display the 2D coordinates "attached" to the mouse.

jswift-stfc commented 2 years ago

Yes, I'd say that is definitely the way to go about this.

jswift-stfc commented 2 years ago

Regarding displaying near the mouse pointer - do you think that's as simple as maintaining a TextEntity, storing the 2D coordinate, and anchoring in at the mouse position, as it is moved?

trisyoungs commented 2 years ago

Seems like a perfectly reasonable solution to me. You'll have to map the mouse coordinate to a 3D position to anchor the label at - the screenToAxes2D() function introduced recently will help.

jswift-stfc commented 2 years ago

I was eying that function up!