1
0
Fork 0

🚧 Progress on paths/beziers

This commit is contained in:
Joost De Cock 2018-08-01 14:55:54 +02:00
parent 2b4aa77986
commit 6f52ccfd2e
5 changed files with 75 additions and 14 deletions

View file

@ -70,6 +70,7 @@ export function shorthand(part) {
let final = part.context.settings.mode === "draft" ? true : false;
let paperless = part.context.settings.paperless === true ? true : false;
return {
sa: part.context.settings.sa || 0,
measurements: part.context.settings.measurements || {},
options: part.context.options || {},
values: part.context.values || {},
@ -157,3 +158,14 @@ export function joinPaths(paths, closed = false) {
return joint;
}
/** Convert value in mm to cm or imperial units */
export function units(value, to = "metric") {
if (to === "imperial") return round(value / 25.4) + '"';
else return round(value / 10) + "cm";
}
/** Rounds a value to 2 decimals */
export function round(value) {
return Math.round(value * 1e2) / 1e2;
}