1
0
Fork 0

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:
joostdecock 2021-09-15 20:20:59 +02:00
parent 0da866d923
commit 025cf9b88e
7 changed files with 161 additions and 4 deletions

View file

@ -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
}
}