utils.pctBasedOn()
The utils.pctBasedOn() function is a helper function to be used when
configuring snapped percentage
options.
note
pctBasedOn is also useful for non-snapped percentage options,
since it allows the interface to convert absolute values to percentages and back,
which allows the user to enter both a percentage or an absolute value when editing options.
Signature
object utils.pctBasedOn(String measurement)
Example
const options = {
example: {
pct: 12,
min: 5,
max: 18,
snap: 3,
...pctBasedOn('chest'),
},
}
Notes
This will return an object with toAbs and fromAbs properties that calculate
the option's absolute and relative values based on a measurement. Refer to
snapped percentage options for
more details.