Skip to content

[Feature] Custom Input Map #97

@brenocq

Description

@brenocq

Feature description
Currently, ImPlot3D uses a hardcoded input map for mouse and keyboard interactions. To improve flexibility, it would be useful to create a customizable input map and expose it to the user.

ImPlot has a well-designed input mapping system that could serve as inspiration. Below is the structure of their input map for reference:

// Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse. struct ImPlotInputMap { ImGuiMouseButton Pan; // LMB enables panning when held, int PanMod; // none optional modifier that must be held for panning/fitting ImGuiMouseButton Fit; // LMB initiates fit when double clicked ImGuiMouseButton Select; // RMB begins box selection when pressed and confirms selection when released ImGuiMouseButton SelectCancel; // LMB cancels active box selection when pressed; cannot be same as Select int SelectMod; // none optional modifier that must be held for box selection int SelectHorzMod; // Alt expands active box selection horizontally to plot edge when held int SelectVertMod; // Shift expands active box selection vertically to plot edge when held ImGuiMouseButton Menu; // RMB opens context menus (if enabled) when clicked int OverrideMod; // Ctrl when held, all input is ignored; used to enable axis/plots as DND sources int ZoomMod; // none optional modifier that must be held for scroll wheel zooming float ZoomRate; // 0.1f zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click); make negative to invert IMPLOT_API ImPlotInputMap(); };

It would also be useful to include default input maps. Just like users can switch between dark, light, and classic themes, they should be able to choose from input maps that replicate the behavior of tools like Matlab, Matplotlib, or others.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions