From 56e306d13a9abd1f60fed217c26b143d5410154a Mon Sep 17 00:00:00 2001 From: joostdecock Date: Sun, 12 Sep 2021 13:13:30 +0200 Subject: [PATCH] feat(components): Added new dolls/giants measurements --- .../src/SampleConfigurator/index.js | 79 +++++++++---------- .../src/Workbench/Measurements/index.js | 49 ++++++++++++ .../src/Workbench/Measurements/non-human.js | 43 ++++++++++ 3 files changed, 128 insertions(+), 43 deletions(-) create mode 100644 packages/components/src/Workbench/Measurements/non-human.js diff --git a/packages/components/src/SampleConfigurator/index.js b/packages/components/src/SampleConfigurator/index.js index 16de7ea3331..4effe99da6b 100644 --- a/packages/components/src/SampleConfigurator/index.js +++ b/packages/components/src/SampleConfigurator/index.js @@ -2,7 +2,7 @@ import React, { useState } from 'react' import { FormattedMessage } from 'react-intl' import PatternOptions from './PatternOptions' import { withBreasts, withoutBreasts } from '@freesewing/models' -import neckstimate from '@freesewing/utils/neckstimate' +import nonHuman from '../Workbench/Measurements/non-human.js' const SampleConfigurator = (props) => { const [type, setType] = useState() @@ -45,22 +45,6 @@ const SampleConfigurator = (props) => { 'sample' ) } - const antMan = { ant: {}, b: {}, c: {}, man: {} } - const antWoman = { ant: {}, b: {}, c: {}, woman: {} } - for (let m in withoutBreasts.size42) { - let val = neckstimate(420, m, false) - antMan.ant[m] = val / 10 - antMan.b[m] = val / 5 - antMan.c[m] = val / 2 - antMan.man[m] = val - } - for (let m in withBreasts.size36) { - let val = neckstimate(360, m, true) - antWoman.ant[m] = val / 10 - antWoman.b[m] = val / 5 - antWoman.c[m] = val / 2 - antWoman.woman[m] = val - } return ( + {['dolls', 'giants'].map(type => ( +
  • +
    + +
    + +
  • + ))} ) } diff --git a/packages/components/src/Workbench/Measurements/index.js b/packages/components/src/Workbench/Measurements/index.js index 76cb442dd2d..207f801b9b9 100644 --- a/packages/components/src/Workbench/Measurements/index.js +++ b/packages/components/src/Workbench/Measurements/index.js @@ -4,6 +4,7 @@ import { FormattedMessage } from 'react-intl' import FormFieldMeasurement from '../../.form/FormFieldMeasurement' import { withBreasts, withoutBreasts } from '@freesewing/models' import Icon from '../../Icon' +import nonHuman from './non-human' const Measurements = (props) => { const styles = { @@ -56,12 +57,14 @@ const Measurements = (props) => { ) + return (

    +
    Humans
      {Object.keys(withoutBreasts).map((m) => (
    • @@ -84,6 +87,52 @@ const Measurements = (props) => {
    • ))}
    +
    Dolls
    +
      + {Object.keys(nonHuman.withoutBreasts.dolls).map((m) => ( +
    • + +
    • + ))} + {Object.keys(nonHuman.withBreasts.dolls).map((m) => ( +
    • + +
    • + ))} +
    +
    Giants
    +
      + {Object.keys(nonHuman.withoutBreasts.giants).map((m) => ( +
    • + +
    • + ))} + {Object.keys(nonHuman.withBreasts.giants).map((m) => ( +
    • + +
    • + ))} +

    diff --git a/packages/components/src/Workbench/Measurements/non-human.js b/packages/components/src/Workbench/Measurements/non-human.js new file mode 100644 index 00000000000..1a56b7700d8 --- /dev/null +++ b/packages/components/src/Workbench/Measurements/non-human.js @@ -0,0 +1,43 @@ +import { withBreasts, withoutBreasts } from '@freesewing/models' + +const nonHuman = { + withoutBreasts: { + dolls: {}, + giants: {} + }, + withBreasts: { + dolls: {}, + giants: {} + } +} +const round = val => Math.round(val*10)/10 + +for (let i=0.1;i<1;i+=0.1) { + const name = `Doll ${Math.round(i*10)}/10` + nonHuman.withBreasts.dolls[name] = {} + // withBreasts: Based on Anneke (size 34) + for (const [m, val] of Object.entries(withBreasts.size34)) { + nonHuman.withBreasts.dolls[name][m] = round(val * i) + } + // withoutBreasts: Based on Ronan (size 42) + nonHuman.withoutBreasts.dolls[name] = {} + for (const [m, val] of Object.entries(withoutBreasts.size42)) { + nonHuman.withoutBreasts.dolls[name][m] = round(val * i) + } +} +for (let i=1;i<=2.5;i+=0.5) { + const name = `Giant ${i}/1` + nonHuman.withBreasts.giants[name] = {} + // withBreasts: Based on Anneke (size 34) + for (const [m, val] of Object.entries(withBreasts.size34)) { + nonHuman.withBreasts.giants[name][m] = round(val * i) + } + nonHuman.withoutBreasts.giants[name] = {} + // withoutBreasts: Based on Ronan (size 42) + for (const [m, val] of Object.entries(withoutBreasts.size42)) { + nonHuman.withoutBreasts.giants[name][m] = round(val * i) + } +} + +export default nonHuman +