feat(core): Snapping of percentage options
This commit implements the snapping of percentage options as outlined in this proposal: https://github.com/freesewing/freesewing/discussions/1331 Please refer to the link above for all details
This commit is contained in:
parent
0da866d923
commit
025cf9b88e
7 changed files with 161 additions and 4 deletions
|
@ -352,3 +352,11 @@ export function rad2deg(radians) {
|
|||
|
||||
// Export bezier-js so plugins can use it
|
||||
export { Bezier }
|
||||
|
||||
export function pctBasedOn(measurement) {
|
||||
return {
|
||||
toAbs: (val, { measurements }) => measurements[measurement] * val,
|
||||
fromAbs: (val, { measurements }) => Math.round( ( 10 * val) / measurements[measurement]) / 10
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue