2023-05-03 20:59:15 -07:00
|
|
|
---
|
|
|
|
title: absoluteOptions
|
|
|
|
---
|
|
|
|
|
|
|
|
The `absoluteOptions` setting holds the values for snapped percentage options.
|
|
|
|
|
2024-09-28 13:13:48 +02:00
|
|
|
:::tip
|
2023-05-03 20:59:15 -07:00
|
|
|
|
|
|
|
The `absoluteOptions` setting is not intended to be set directly.
|
|
|
|
Instead, using _snapped percentage options_ will automatically cause
|
|
|
|
the option values to be generated.
|
|
|
|
You can access these values through the destructured `absoluteOptions`
|
|
|
|
property.
|
|
|
|
|
|
|
|
Please see the
|
|
|
|
[snapped percentage options reference](/reference/api/part/config/options/pct/snap)
|
|
|
|
for more details.
|
|
|
|
|
2024-09-28 13:13:48 +02:00
|
|
|
:::
|
2023-05-03 20:59:15 -07:00
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
```js
|
|
|
|
const settings = {
|
|
|
|
Object absoluteOptions={}
|
|
|
|
}
|
|
|
|
```
|
2023-05-05 18:06:05 -07:00
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```js
|
|
|
|
export const part = {
|
|
|
|
name: 'example.part',
|
|
|
|
measurements: [ 'waist' ],
|
|
|
|
options: {
|
|
|
|
width: {
|
|
|
|
pct: 5, min: 1 max: 25, snap: 7,
|
|
|
|
toAbs: (pct, { measurements }) => measurements.waist * pct,
|
2023-05-05 18:07:57 -07:00
|
|
|
}
|
2023-05-05 18:06:05 -07:00
|
|
|
},
|
|
|
|
draft: ({ absoluteOptions }
|
|
|
|
) => {
|
|
|
|
const garmentWidth = absoluteOptions.width * 1.1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|