emilk / emilk/egui

A Response for background

Open
#2,218 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Is your feature request related to a problem? Please describe.**
Creating a context menu requires a `Response`, let's say I just want the context menu functionality without anything else. I would create a `CentralPanel` with `Frame::none()` and no elements and get the `Response` for a context menu from there.
If the GUI is more HUD-like, where everything outside/under the GUI is a view into some other content, for example a 2D map, that you can pan around. I would receive the inputs in the window space and translate it into some action in map space, for example creating a pin on the map with a left click. However, since I do not want to create a pin when interacting with egui's context menu I query egui with `wants_pointer_input`.
But since I used a` CentralPanel` `wants_pointer_input` will always return true (IF the code creating the `CentralPanel` runs before the pin code in a frame).

**Describe the solution you'd like**
An ability to get a `Response` from a `Context` for interaction with anything that technically isn't part of any egui element.

**Describe alternatives you've considered**
I wasn't sure if this should be more of a feature request or a bug in a vein of "Context always wants input with CentralPanel" or "FrameState doesn't respect Frame::none".
As for other solutions, the order of the `wants_pointer_input` and `show`ing the `CentralPanel` matters, but I still think it should be fixed as in multithreaded/dynamically ordered frame code this may be a race condition or a problem that appears at random on different runs of the program.

Contributor guide

Open the contributing guide

Research direction

Start by reading the Context, CentralPanel, and Response APIs involved in pointer-input handling. Compare the current CentralPanel behavior with the requested context-level interaction response, then define and validate an approach that lets callers handle context-menu input without treating the empty panel as the underlying map interaction target.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.