fixed bug with re-ordered sorting layers

The existing implementation assumes that `sortingLayerID` is equal to the index in the `sortingLayerNames`. This is not true if the user reorders the sorting layers.

This implementation uses sorting layer names instead of IDs. It searches the current selected index based on the sorting layer name,  and sets the `sortingLayerName` based on the newLayerIndex and the sortingLayerNames array.