getCharactersInOrder

Takes an argument of a page name as a string, which corresponds to a config file.

For example:

module.exports = { spr5l: { '2_adults': { '3_children': [ { type: 'child', index: 0 }, { type: 'adult', index: 1 }, { type: 'child', index: 1 }, ], '2_children': [ { type: 'child', index: 0 }, { type: 'adult', index: 1 }, { type: 'child', index: 1 }, ], '1_children': [ { type: 'child', index: 0 }, { type: 'adult', index: 1 }, ], }, } }

This file continues based on all the character permutations for the spread.

In the product's set of template helpers, the following function relates to the unique customisation and character configuration. What is returned is used for the mapping to create an array of character details based on the order they are stacked in the page, given in the config file.

getAvatarConfig(spread) { const children = this.getCharacterGroupCustomisations(0); const adults = this.getCharacterGroupCustomisations(1); return avatarOrder[spread][`${adults.length}_adults`][[`${children.length}_children`]]; }

This avoids the need for z-index tweaking and lots of complex logic in the pug template.

- const ordered = helpers.getCharactersInOrder('spr5l') - const children = helpers.getCharacterGroupCustomisations(0) - const adults = helpers.getCharacterGroupCustomisations(1) - const pose = 'spr-5' for item, index in ordered - const opts = { pose, index: item.index, type: item.type, adults: children.length, } object( data-muse-action='flatten' data=helpers.getInlineAvatarPath(opts, item.params) type="text/html" )