mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-15 23:48:31 +00:00
Merge pull request #284 from malikolivier/fix-build-with-ref
Fix toggling of MenuItem and Selectable with build_with_ref
This commit is contained in:
commit
ccec55c10a
@ -14,6 +14,11 @@
|
||||
|
||||
- Various things that were deprecated in imgui-rs 0.2.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix toggling behavior on using `MenuItem::build_with_ref` and
|
||||
`Selectable::build_with_ref`.
|
||||
|
||||
## [0.2.1] - 2019-09-09
|
||||
|
||||
### Fixed
|
||||
|
||||
@ -143,7 +143,7 @@ impl<'a> MenuItem<'a> {
|
||||
/// Builds the menu item using a mutable reference to selected state.
|
||||
pub fn build_with_ref(self, ui: &Ui, selected: &mut bool) -> bool {
|
||||
if self.selected(*selected).build(ui) {
|
||||
*selected = true;
|
||||
*selected = !*selected;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
||||
@ -123,7 +123,7 @@ impl<'a> Selectable<'a> {
|
||||
/// Builds the selectable using a mutable reference to selected state.
|
||||
pub fn build_with_ref(self, ui: &Ui, selected: &mut bool) -> bool {
|
||||
if self.selected(*selected).build(ui) {
|
||||
*selected = true;
|
||||
*selected = !*selected;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user