sirinsidiator / ESO-LibAddonMenu

http://www.esoui.com/downloads/info7-LibAddonMenu.html
Artistic License 2.0
41 stars 20 forks source link

Fix multi-select dropdowns flip-flopping between empty and not #140

Closed mycroftjr closed 3 months ago

mycroftjr commented 3 months ago

https://github.com/Baertram/ESO-LibAddonMenu/blob/master/LibAddonMenu-2.0/controls/dropdown.lua#L73-L97 currently only clears dropdown.m_selectedItemData, but m_enableMultiSelect dropdowns use m_multiSelectItemData instead. Because that isn't cleared, dropdown:SetSelectedItemByEval resolves eventually into SelectItem (which, in /EsoUI/Libraries/ZO_ComboBox/ZO_ComboBox.lua:341, self:RemoveItemFromSelected(item) if the item was already self:IsItemSelected(item) ). So ultimately, UpdateMultiSelectSelected currently untoggles everything when called (for multiSelect only). This fixes that by clearing m_multiSelectItemData also.

For clarification, the repro steps:

  1. Have any multi-select dropdowns with elements selected in them
  2. Do anything to any other control in the same panel while watching the summary text on the multiselects
  3. Watch the multiselects flip between e.g. 3 selected and none selected (at least visually)
mycroftjr commented 3 months ago

@sirinsidiator

Baertram commented 3 months ago

Good find. zo_combobox go that too, I simply missed it: https://github.com/esoui/esoui/blob/7d5ebebfe4124ff4de44de89ef5d6f4287d669fb/esoui/libraries/zo_combobox/zo_combobox.lua#L31

mycroftjr commented 2 months ago

Thanks. Can confirm that this fixes the issue as described. Next time please make sure to increment the widget version too.

Oh right, I'll try to remember to do that if I need to make any other changes :)