API for user interactions #48
Replies: 3 comments 1 reply
-
Thanks for the feedback!
❤️
There is a Q&A about fitting all axes in #41. You could also use
Being able to set the Next rotation/axis limits sounds like a great idea! ImPlot does provide an API for that, and so should ImPlot3D https://github.com/epezent/implot/blob/master/implot.h#L793-L803 |
Beta Was this translation helpful? Give feedback.
-
I just discovered that the For example, should we have a I'll start the implementation of this user API as a
It is possible to set the pan/zoom using the existing |
Beta Was this translation helpful? Give feedback.
-
Hi @dimateos! Rotation APIThe PR #61 was just merged to expose an API to set the current and initial rotations. You can use the following methods for that:
if (ImPlot3D::BeginPlot("##BoxRotation")) {
// Set initial rotation
ImPlot3D::SetupBoxInitialRotation(init_elevation, init_azimuth);
// Set the rotation using the specified elevation and azimuth
if (setRotation)
ImPlot3D::SetupBoxRotation(elevation, azimuth, animate, ImPlot3DCond_Always);
...
ImPlot3d::EndPlot();
} Zoom/pan APIThe zoom/pan can be currently set programmatically using the if (ImPlot3D::BeginPlot("##BoxRotation")) {
// Set initial limits
ImPlot3D::SetupAxesLimits(x_min, x_max, y_min, y_max, z_min, z_max, ImPlot3DCond_Once);
// Set the rotation using the specified elevation and azimuth
if (setPanZoom)
ImPlot3D::SetupAxesLimits(x_min, x_max, y_min, y_max, z_min, z_max, ImPlot3DCond_Always);
...
ImPlot3d::EndPlot();
} Note that if you use I'll be closing this discussion for now since it is now possible to programmatically rotate/pan/zoom. Let me know if this works well for you. We can open this discussion again if more work is needed! |
Beta Was this translation helpful? Give feedback.
-
First of all, this lib is looking lit! congrats and thanks a lot for sharing :)
I was thinking about my potential users and how they usually prefer context-menus/buttons over complex hotkeys/mouse-interactions.
So I guess I would love some additional API for simulating user interaction programmatically e.g. resetting zoom or fitting all axis. Then I could add some visual button to call them or by necessity when reloading etc. This API calls could also be added to the exiting context menu!
There is #19 about initial pan/rot/zoom, I guess I would be talking about setting next.
Some suggestions may become doable by external developers without modifying the internals.
Would be more involved for them but could leverage work in the future and also be used to make interaction prototypes.
Also could reference here #26, customizable interactions (e.g. panning with mouse wheel hold down instead of zooming). These could be potentially easier to implement with API present for the lib user too?
AFAIK imPlot is not so configurable, I guess because this could make the codebase harder to maintain.
But also note that 3D plots are harder to navigate than 2D and are usually less intuitive for users.
Just wanted to drop this here for discussion!
Beta Was this translation helpful? Give feedback.
All reactions