blitzarx1 / egui_graphs

Interactive graph visualization widget for rust powered by egui and petgraph
https://docs.rs/crate/egui_graphs
MIT License
388 stars 29 forks source link

make SettingsStyle.labels_always public #202

Closed nacl42 closed 6 days ago

nacl42 commented 3 weeks ago

Refers to: egui_graphs version: 0.21.1

I tried to implement my own NodeShape, using the given DefaultNodeShape as starting point.

The following line will not work in a new NodeShape object outside of the crate:

let label_visible = ctx.style.labels_always || self.selected || self.dragged;

I suggest to change the visibility of labels_always from pub(crate) to pub or alternatively add a getter method such as fn labels_always(&self) -> bool to SettingsStyle.

Everything else worked for my own custom NodeShape.

blitzarx1 commented 1 week ago

SettingsStyle has with_labels_always_method which you can use to set labels_always property. It works the same as setters for other Settings... structs.

You can check the usage of the with_labels_always_method in the interactive example source code.

blitzarx1 commented 1 week ago

@nacl42 please comment if this is solved?

blitzarx1 commented 6 days ago

Closing it as everything seems to work...