Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to control the order in which grouped layers appear in the control #54

Open
CloudNiner opened this issue Aug 2, 2017 · 5 comments

Comments

@CloudNiner
Copy link

It appears that the layer groups draw in the order in which they are added to the control. There are some situations where this may or may not be feasible, and you may want to manually specify the ordering of the layer groups when the control is initialized.

CloudNiner pushed a commit to azavea/pfb-network-connectivity that referenced this issue Aug 2, 2017
The fix for this is awkward. In order to not mess up the
order in which the layer groups draw in the picker, we
have to ensure that we add the "None" layer immediately
before the remaining destinations layers. The group layer
control doesn't give us a way to specify a particular order.

If we only add based on whether the ctl.destinationsNoneLayer
exists or not, we create it too early during the first scope
resolution, and the Destinations draw before the Overlays.

If we just create based on whether layers are present in the
$q.all callback, we may double create the none layer.

Opened:
ismyrnow/leaflet-groupedlayercontrol#54
@ismyrnow
Copy link
Owner

ismyrnow commented Oct 5, 2017

Do you know how the standard leaflet layer control works in this regard? Most of the code for this control comes from that implementation, and we only add the extra group stuff. If the leaflet control works differently, then perhaps our implementation needs to be updated (recopied, basically).

@ismyrnow
Copy link
Owner

ismyrnow commented Oct 5, 2017

Would the PR #43 fix this issue for you?

@grischard
Copy link

The default sort in my PR is to sort alphabetically. A lazy hack to get some layers to show up at the top is to prefix the name with an html comment, e.g. '<!--sort:4-->'

@grischard
Copy link

@ismyrnow sorry to bother you, do you think it would be possible to merge my #43 please?

@SchroeC
Copy link

SchroeC commented Jan 25, 2019

This is great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants