iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
9 stars 2 forks source link

UiItemsProvider.getWidget #1102

Closed a-gagnon closed 2 weeks ago

a-gagnon commented 2 weeks ago

Describe the bug

Hi, I'm currently transitioning from provideWidgets to getWidgets, and I found a case that use to be supported with the old method, but doesn't work anymore with getWidgets.

We have a widget that was always returned by the provideWidgets function. By that, I mean there was no conditional logic based off the StagePanelLocation as we didn't want it to be docked to any panel. We were using the canFloat properties of the widget object. We typically kept that widget in Hidden state by default, until certain conditions were met in which case we called WidgetDef.show() on it to display it in floating state.

Now that we've transitioned to using getWidgets, it seems if I don't provide any layout, the widget is not added to the frontstage at all. If I do provide a standard layout, it puts my widget into one of the stage panels and I'd like to keep it floating by default. EDIT: I think it was due to my local cache.

Any thoughts? Introducing StagePanelLocation.Floating might work, but then the code would need to validate that canFloat: CanFloatWidgetOptions properties are being set accordingly... I'll leave it to you to figure the best course of action.

Thanks! Alex

To Reproduce

No response

Expected Behavior

No response

Screenshots

No response

Desktop (please complete the applicable information)

No response

Additional context

No response

a-gagnon commented 2 weeks ago

After playing with the various settings a bit and clearing local cache, everything seems to work properly. It feels a bit weird to have to provide stage panel location for something we'd expect to be floating, but I guess that's how it is.

GerardasB commented 1 week ago

Nice, that you have figured it out. The intention was to use layouts property to filter items specific to a frontstage layout. We probably could have made location and section optional (ATM they serve as a default section as well).