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

Sort layers alphabetically if sort order matches #332

Open
RobQuincey-DC opened this issue Jan 27, 2025 · 0 comments
Open

Sort layers alphabetically if sort order matches #332

RobQuincey-DC opened this issue Jan 27, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@RobQuincey-DC
Copy link
Contributor

Layers are currently sorted by their sortOrder parameter. When layers all have the same sortOrder (which is often the case when no particular order is required), they will then be ordered by the order they come in, which is pretty random.

Instead, anything with the same sortOrder should be ordered by name.

The following in LayerList.ts:127 should do the trick.

    category.layers
      .sort((a, b) => {
        if (a.sortOrder === b.sortOrder) {
          return a.name.localeCompare(b.name);
        }
        return a.sortOrder - b.sortOrder;
      })
      .forEach((layer) => {
        const listItem = this.createLayerListItem(layer);
        listContainer.appendChild(listItem);
      });
@RobQuincey-DC RobQuincey-DC added enhancement New feature or request good first issue Good for newcomers labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant