Touchmenu: fix menu refreshing on check#13996
Conversation
|
I have a hard time reading/understanding these names (that can be true or false): If we can't find better names, I think they deserve some comment in the TouchMenuItem declaration. |
|
"on check" is a prefix, this is about items with checkmarks only, "on check" means "on tap". |
|
This flag is placed right before the callback function, to be clearer that it is about the following callback. |
on_check_updated_in_callback = nil, -- set to true for item with checkmark if its callback updates menu
on_check_closed_in_callback = nil, -- set to true for item with checkmark if its callback closes menuI'm still bothered by the callback_updates_menu = true,
callback_closes_menu = true, |
|
|
Starting the things with |
|
Okay |
By default, on tapping an item with a checkmark the Touchmenu:
(1) keeps the menu open
(2) highlights the item
(3) unhighlights the item
(4) fires the callback
(5) updates itself to show the changes.
If the callback updates the menu, (5) is not needed.
If the callback closes the menu, (3) and (5) are not needed.
This PR allows to avoid menu update duplicating and to avoid calling unneeded unhighlighting.
This change is