1
0
Fork 0
freesewing/packages/simon/src/shared.js

19 lines
733 B
JavaScript
Raw Normal View History

2018-12-21 18:19:21 +01:00
export const calculateReduction = function(part) {
let { store, measurements, options } = part.shorthand();
if(store.get('reduction') === true) return;
let chest = measurements.chestCircumference * (1+ options.chestEase);
let waist = measurements.naturalWaist * (1+ options.waistEase);
let hips = measurements.hipsCircumference * (1+ options.hipsEase);
let waistReduction = chest - waist;
let hipsReduction = chest - hips;
// If your waist > chest, this pattern is not going to work for you as-is.
if (waistReduction < 0) waistReduction = 0;
if (hipsReduction < 0) hipsReduction = 0;
store.set("waistReduction", waistReduction);
store.set("hipsReduction", hipsReduction);
store.set("reduction", true);
}