feat(components): Added new dolls/giants measurements
This commit is contained in:
parent
631b33d636
commit
56e306d13a
3 changed files with 128 additions and 43 deletions
|
@ -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 (
|
||||
<ul>
|
||||
|
@ -124,34 +108,43 @@ const SampleConfigurator = (props) => {
|
|||
<FormattedMessage id="app.withoutBreasts" />
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="#logo"
|
||||
onClick={() => {
|
||||
sampleModels(antWoman)
|
||||
setType('models')
|
||||
setInstance('antWoman')
|
||||
}}
|
||||
className={type === 'models' && instance === 'antWoman' ? 'active' : ''}
|
||||
>
|
||||
Antperson (with breasts)
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="#logo"
|
||||
onClick={() => {
|
||||
sampleModels(antMan)
|
||||
setType('models')
|
||||
setInstance('antMan')
|
||||
}}
|
||||
className={type === 'models' && instance === 'antMan' ? 'active' : ''}
|
||||
>
|
||||
Antperson (without breasts)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
{['dolls', 'giants'].map(type => (
|
||||
<li key={type}>
|
||||
<h5>
|
||||
<FormattedMessage id={`app.${type}`} />
|
||||
</h5>
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
href="#logo"
|
||||
onClick={() => {
|
||||
sampleModels(nonHuman.withBreasts[type])
|
||||
setType('models')
|
||||
setInstance('withBreasts')
|
||||
}}
|
||||
className={type === 'models' && instance === 'withBreasts' ? 'active' : ''}
|
||||
>
|
||||
<FormattedMessage id="app.withBreasts" />
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="#logo"
|
||||
onClick={() => {
|
||||
sampleModels(nonHuman.withoutBreasts[type])
|
||||
setType('models')
|
||||
setInstance('withoutBreasts')
|
||||
}}
|
||||
className={type === 'models' && instance === 'withoutBreasts' ? 'active' : ''}
|
||||
>
|
||||
<FormattedMessage id="app.withoutBreasts" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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) => {
|
|||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<div style={styles.container}>
|
||||
<div style={styles.chooser}>
|
||||
<h4 id="preload">
|
||||
<FormattedMessage id="cfp.preloadMeasurements" />
|
||||
</h4>
|
||||
<h5>Humans</h5>
|
||||
<ul style={styles.ul}>
|
||||
{Object.keys(withoutBreasts).map((m) => (
|
||||
<li key={`${m}-without`} style={styles.li}>
|
||||
|
@ -84,6 +87,52 @@ const Measurements = (props) => {
|
|||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<h5>Dolls</h5>
|
||||
<ul style={styles.ul}>
|
||||
{Object.keys(nonHuman.withoutBreasts.dolls).map((m) => (
|
||||
<li key={`${m}-without`} style={styles.li}>
|
||||
<Button onClick={() => props.preloadMeasurements(nonHuman.withoutBreasts.dolls[m])}>
|
||||
<Icon icon="withoutBreasts" />
|
||||
<FormattedMessage id="cfp.size" />
|
||||
|
||||
{m}
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
{Object.keys(nonHuman.withBreasts.dolls).map((m) => (
|
||||
<li key={`${m}-with`} style={styles.li}>
|
||||
<Button onClick={() => props.preloadMeasurements(nonHuman.withBreasts.dolls[m])}>
|
||||
<Icon icon="withBreasts" />
|
||||
<FormattedMessage id="cfp.size" />
|
||||
|
||||
{m}
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<h5>Giants</h5>
|
||||
<ul style={styles.ul}>
|
||||
{Object.keys(nonHuman.withoutBreasts.giants).map((m) => (
|
||||
<li key={`${m}-without`} style={styles.li}>
|
||||
<Button onClick={() => props.preloadMeasurements(nonHuman.withoutBreasts.giants[m])}>
|
||||
<Icon icon="withoutBreasts" />
|
||||
<FormattedMessage id="cfp.size" />
|
||||
|
||||
{m}
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
{Object.keys(nonHuman.withBreasts.giants).map((m) => (
|
||||
<li key={`${m}-with`} style={styles.li}>
|
||||
<Button onClick={() => props.preloadMeasurements(nonHuman.withBreasts.giants[m])}>
|
||||
<Icon icon="withBreasts" />
|
||||
<FormattedMessage id="cfp.size" />
|
||||
|
||||
{m}
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div style={styles.chooser}>
|
||||
<h4 id="manual">
|
||||
|
|
43
packages/components/src/Workbench/Measurements/non-human.js
Normal file
43
packages/components/src/Workbench/Measurements/non-human.js
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue