platform icon indicating copy to clipboard operation
platform copied to clipboard

layerGroups popupContent popup(s) not closing on layergroup toggle-off

Open reterraform opened this issue 6 years ago • 7 comments

Hello, I'm leveraging popupContent popups for some non-api-dataset externally sourced layergroups, which work fine till the layer is toggled 'off' (non-visible) from left-sidebar, leaving the popup(s) remaining open/visible w/o the layer they reference (ie orphaned). Tried closing from the LeftSidebarSectionSelector.onToggleLayerGroup property, but having no luck (can prevent popups' opening from there, but not able to close em). Also tested forcing close from client-side script (i know, hacky :/ ), but no luck there either (the emotion styling seems to make it more challenging to reference DOM objects; for me anyhoo).

Any tips re how & where to best etc greatly appreciated, as always!

reterraform avatar Oct 27 '19 16:10 reterraform

???

reterraform avatar Nov 02 '19 01:11 reterraform

Hi-- thanks for reporting this issue. You're definitely right that a popup will stay open if its layer is switched off-- we hadn't considered that interaction but I agree it produces a weird effect.

From what I can tell there isn't a ready way to automatically close popups in the current implementation if their parent layer is switched off. I believe what we'd need to do is track which layer the current popup belongs to, then have a check in the componentDidUpdate lifecycle method of the MainMap component to determine if that layer has been switched off and, if so, hide the popup.

You can see how the popup's content and position get set here: https://github.com/mapseed/platform/blob/1d184c80d7cdf7a81e828130022f4b756128686c/src/base/static/components/organisms/main-map.tsx#L488-L512

And where the popup is rendered here: https://github.com/mapseed/platform/blob/1d184c80d7cdf7a81e828130022f4b756128686c/src/base/static/components/organisms/main-map.tsx#L625-L642

I can probably add a feature to automatically close popups in the next couple of weeks. In the meantime you can experiment with setting the closeOnClick prop of the Popup to true-- not a solution, but it gives you a larger target to click to close the popup at least.

goldpbear avatar Nov 02 '19 02:11 goldpbear

Thanks for that helpful info Trevor! I'll give those ideas a look & see if I can get some traction. Meanwhile, really appreciate & look forward to that potential feature addition (especially if I continue to flail w/ my 'hack' efforts). :/

CHEERS

reterraform avatar Nov 04 '19 16:11 reterraform

Sure thing-- thanks again for your interest in Mapseed! I'll try to push up a fix for the popups as soon as I can. We're wrapping up a big feature atm, but once that's done I should get some time.

goldpbear avatar Nov 05 '19 01:11 goldpbear

sounds good; thanks once again!

reterraform avatar Nov 06 '19 00:11 reterraform

Know you folks are busy with plenty of tasks, but just checking in on status of this issue. All your good works much appreciated, in any case! :)

reterraform avatar Feb 14 '20 01:02 reterraform

Hey-- thanks for checking in! And sorry for the delay on this request.

Unfortunately at this point I don't think we can give an estimated ship date. We're working at a reduced capacity lately balancing this project with others, and it's difficult to provide an estimate. I wish it were otherwise, though.

We definitely appreciate your interest, and I'd be happy to try and recommend other tools that might be able to meet your use case more readily, if that's an option for you.

goldpbear avatar Feb 15 '20 00:02 goldpbear