By default the OL layer switcher shows layers with higher Z-value (layers on top) as being on the bottom of the layers switcher.
This can be changed by setting the 'ascending:false' option on construction.

This task is to add such option in the behavior.

Comments

strk’s picture

Assigned: Unassigned » strk
Status: Active » Fixed

Committed in #414060

zzolo’s picture

Status: Fixed » Needs work

Just looking at this, it looks like it would cause errors for anyone that is upgrading since that descending variable is not set in JS and that could trigger an error when trying to use it. Depends on how OL handles it. Needs work?

tmcw’s picture

Also, if there's a revision of this, could it be possible to quickly reverse its behavior, so that it isn't necessary to switch around terms and find the negation in javascript? The closer to OpenLayers API we can get on the PHP side the better.

strk’s picture

@zzolo : did you test that upgrade thing to be a real issue ? I tought the php part was just always passing a 'descending' variable to JS. Am I being wrong ? No behavior PHP involved at rendering time ?

@tmwc : the reason why I used 'descending' is so that the unchecked state represents the OL default. 'ascending' is an opt-in....

strk’s picture

Oops, of course I meant 'ascending' is true by default in OL, so 'ascending:false' is an opt-in, thus 'descending'

zzolo’s picture

Hey @strk. Yeah, looking back into the behavior class, this should be alright. And after testing, looks fine. Sorry for jumping the gun.

I do agree with the both of you. It should not be an opposite of a value unless it is necessary, but of course should keep the default behavior. This just means that the checkbox should be TRUE by default, and the label updated accordingly. Also, on that note, saying something like Z-index means very little to most users.

strk’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.