Closed klingo closed 5 years ago
Hi. Thanks for the contribution and sorry for not answering earlier. I will review this as soon as I can and hope to upload a new LAM version before Wrathstone goes live.
Regarding your description, wouldn't it be desirable to close and prevent the submenu from opening when it is disabled?
Hi, yes this indeed was the originally desired behaviour.
I tried to implement that and managed to block any interaction with the panel itself, but couldn't figure out how to also trigger the collapsing-animation in case the panel is in expanded state. Since it would be bad user experience if the panel interaction is disabled but stays expanded, I removed the first part again.
In the meanwhile (for my own Add-On) I put the checkbox that enables/disables the submenu inside the panel itself. If it is closed you immediately see if the features under that topics are enabled or disabled (due to different text-color); and if you want to change it you anyway open it to check the other settings. This way I can "hide" the different ON/OFF checkboxes from the main panel and make it look more clean.
So... I'm not sure now which should be the target behavior :)
I'd prefer it to actually disable the interaction with the submenu. That way it is consistent with how the property works on other widgets.
I haven't tried it yet, but calling the animation:PlayFromStart method when the menu is open should be all it takes to close it.
local function UpdateDisabled(control)
local disable
if type(control.data.disabled) == "function" then
disable = control.data.disabled()
else
disable = control.data.disabled
end
if disable then
control.label:SetColor(ZO_DEFAULT_DISABLED_COLOR:UnpackRGBA())
if control.open then
control.animation:PlayFromStart()
end
else
control.label:SetColor(ZO_DEFAULT_ENABLED_COLOR:UnpackRGBA())
end
end
That's what I was trying as well, unfortuantely it does not work though (i.e. nothing happens).
I made another commit that adds the logic to prevent the submenu from expanding/collapsing when it is set to disabled. So only closing animation should be missing.
Ok. I'll take a look later.
You need to set control.open = false
before calling PlayFromStart. Otherwise it will think you just opened the menu in OnStop.
In your last commit you also removed the disabled color. It always shows the label in white now and the color of the arrow also doesn't get adjusted.
Oh I see, that's why no animation happened. Thanks for spotting that; I noticed that I added two local variables for the colors that haven't been used and wanted to delete them; turns out I deleted too much.
In the latest comit I included all your feedback, and from what I can see it is working fine now.
Ok. I'll merge it now. Thanks again for contributing. :)
This change does:
This change does NOT: