nl_tokens: Change the order of the layer in the stack . @param { Object } state Current state . @param { Object } action Action to handle .
pl_tokens: function orderLayer ( state , <mask> ) { let layer = null , target = null ; for ( let i = 0 , ii = state . layers . length ; i < ii ; i ++ ) { if ( state . layers [ i ] . id === action . layerId ) { layer = state . layers [ i ] ; } if ( state . layers [ i ] . id === action . targetId ) { target = state . layers [ i ] ; } } if ( layer !== null ) { let targetId = action . targetId ; let targetGroup = getGroup ( target ) ; let layerGroup = getGroup ( layer ) ; if ( layerGroup !== targetGroup ) { targetId = changeTarget ( state , action ) ; } if ( targetId !== false ) { return placeLayer ( state , layer , targetId ) ; } } return state ; }