Allow glue opt-out, even when bound

This commit is contained in:
Bán Dénes 2021-12-15 23:05:40 +01:00
parent c46a0bcd16
commit 21cfc1fd35
3 changed files with 159 additions and 2 deletions

View file

@ -135,8 +135,13 @@ const layout = exports._layout = (config = {}, points = {}, units = {}) => {
if (side == 'left') return left
if (side == 'right') return right
// allow opting out of gluing, when
// A) there are no glue definitions, or
// B) glue is explicitly set to false
const glue_opt_out = (!Object.keys(parsed_glue).length || params.glue === false)
let glue = {models: {}}
if (bound && ['middle', 'both', 'glue'].includes(side)) {
if (bound && ['middle', 'both', 'glue'].includes(side) && !glue_opt_out) {
const default_glue_name = Object.keys(parsed_glue)[0]
const computed_glue_name = a.sane(params.glue || default_glue_name, `${export_name}.glue`, 'string')()