Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot::Items::default_visible allow hidden on init #2557

Closed
wants to merge 10 commits into from

Conversation

haricot
Copy link
Contributor

@haricot haricot commented Jan 8, 2023

added feature described in this issue #2395

@haricot haricot changed the title Plot::Items::visible allow hidden on init Plot::Items::visible allow hidden on init Jan 8, 2023
crates/egui/src/widgets/plot/items/mod.rs Outdated Show resolved Hide resolved
Comment on lines 186 to 188
let hiddened= !(checked && visible || !checked && !visible);

if hiddened {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let hiddened= !(checked && visible || !checked && !visible);
if hiddened {
if checked != visible {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…though I struggle to follow he logic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another possible logic without default_visible but with visible checking if it's in hidden_items.
(requires a PR to access hidden items, which seems necessary to know if the item is hidden in a future case.
and surely a specific logic for the visible.
)

let visibility_points = !hidden_items.contains("Points");
plot_ui.points(points.name("Points").visible(visibility_points);

although with default_visible we set a state from the start, we don't have access to its modified state.
while with visible it will allow to have its state hidden or not dynamically.

I don't think they are the same thing all the same.
with default_visible we define a state from the start which is clear to me.
When to know if it is in hidden_items it is another problem.
I think I have a preference for default_visible to solve this feature.
But maybe an alternative and necessary PR to compare.

@haricot haricot changed the title Plot::Items::visible allow hidden on init Plot::Items::default_visible allow hidden on init Jan 23, 2023
@emilk
Copy link
Owner

emilk commented Jul 15, 2024

egui_plot has recently been moved to its own repository, at https://github.com/emilk/egui_plot

This will hopefully speed up its development by having more reviewers and maintainers.

Please re-open this PR at https://github.com/emilk/egui_plot/pulls

See also:

@emilk emilk closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants