Esri / arcgis-maps-sdk-swift-toolkit

Mapping components that will simplify your Swift app development with the ArcGIS Maps SDK for Swift.
https://developers.arcgis.com/swift
Apache License 2.0
29 stars 8 forks source link

Floating Panel dismiss button #923

Open rolson opened 1 week ago

rolson commented 1 week ago

I'm not quite sure where the problem is here. If I add a close button to the floating panel with a utility network trace component, I get this which looks good some of the time:

image

But in some cases when the floating panel is collapsed, the close button is hidden:

image

Is there a better way to support the workflow where you want to dismiss the floating panel and cancel the trace?

mhdostal commented 1 week ago

The example does not allow closing the trace, but I can see the benefit in having a "Cancel" button, maybe alongside the "Trace" and "Clear All Results" buttons.

The "Clear All Results" button gets cut off in your second screen shot; the "Trace" button, prior to running a trace, does not; there must be a slight difference in how those two are handled.

rolson commented 1 week ago

It's not necessarily "cancel". But more like "Done" or "Close". And I don't know that it belongs in the trace component. I think it's the app developer to decide when and how to close it on devices like a phone where it's covering a lot of the real estate. I think this is more of a floating panel issue potentially. Or something odd in the way the floating panel and the trace component work together.

dfeinzimer commented 1 week ago

Coincidentally I received a question this morning from Kotlin about support for programatic trace starting points which got me thinking about a potential workaround for this in interim lieu of custom header support or a close button on the Floating Panel.

Replace UtilityNetworkTraceExampleView.swift with the attached version to try it.

UtilityNetworkTraceExampleView.swift.zip

https://github.com/user-attachments/assets/c39397e6-a905-4bea-bf1e-bc5c4edb5be3

rolson commented 1 week ago

I like that idea. In practice, this doesn't work that well. Maybe it's just a bug in the example code and could be fixed. Also, tapping "Add New" raises questions about what it should do in that case.

dfeinzimer commented 1 week ago

Also, tapping "Add New" raises questions about what it should do in that case.

Agreed, opened issue https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/issues/925

rolson commented 1 week ago

I can't get the UNTrace component to work well in a floating panel when trying to add content (ie Title and Dismiss button) above it. These things just aren't quite playing nicely together. Is there a way to limit the floating panel detent to full and half? That could work for my scenario.

dfeinzimer commented 1 week ago

Is there a way to limit the floating panel detent to full and half? That could work for my scenario.

Not directly currently. I'd think monitoring (and programmatically setting when desired) the bound selectedDetent should work for that though.

rolson commented 1 week ago

I wonder if it would be good to have a built-in way to dismiss the floating panel. Since the drag bar is on the panel, maybe there should be some sort of option for a dismiss/close button. Also the panel has a binding to the isPresented, so it could easily set that to false.

dfeinzimer commented 1 week ago

I wonder if it would be good to have a built-in way to dismiss the floating panel.

I think this definitely makes sense to add.