diff --git a/packages/freesewing.shared/components/workbench/menu/index.js b/packages/freesewing.shared/components/workbench/menu/index.js index 93e6dde5d2b..fdc04f33261 100644 --- a/packages/freesewing.shared/components/workbench/menu/index.js +++ b/packages/freesewing.shared/components/workbench/menu/index.js @@ -12,6 +12,16 @@ export const Details = props => ( ) export const Deg = props => ° +export const NoSumDiv = props => ( +
{props.children}
+) export const SumDiv = props => (
{ + if (!attr || !attr.list || Object.keys(attr.list).length < 1) return null + + return ( +
  • +
    + + + + Attributes + + + +
      + {Object.keys(attr.list).map(at => ( +
    • +
      + + + + {at} + + + +
        + {attr.list[at].map(val => ( +
      • + + + {val} + +
      • + ))} +
      +
      +
    • + ))} +
    +
    +
  • + ) +} + +export default XrayAttributes diff --git a/packages/freesewing.shared/components/workbench/menu/xray/list.js b/packages/freesewing.shared/components/workbench/menu/xray/list.js index 1c794750cca..74d34b5f802 100644 --- a/packages/freesewing.shared/components/workbench/menu/xray/list.js +++ b/packages/freesewing.shared/components/workbench/menu/xray/list.js @@ -14,6 +14,8 @@ const XrayList = props => { let title = props.app.t(`parts.${props.partName}`) if (title !== props.partName || true) title + ` (${props.partName})` + const part = props.gist.xray.parts[props.partName] + return (
  • @@ -31,7 +33,7 @@ const XrayList = props => { - {Object.keys(types).map(type => props.gist.xray.parts[props.partName][type] && ( + {Object.keys(types).map(type => part[type] && (
    • @@ -39,23 +41,39 @@ const XrayList = props => { {type} + + - {Object.keys(props.gist.xray.parts[props.partName][type]) - .map(id => ( -
    • -
      - - - - {id} - - - - {types[type]({...props, id})} -
      -
    • - )) - } +
        + {Object.keys(part[type]) + .map(id => ( +
      • +
        + + + + {id} + + + + + {type === 'paths' && } + {type === 'points' && } +
        +
      • + )) + } +
    diff --git a/packages/freesewing.shared/components/workbench/menu/xray/path-ops.js b/packages/freesewing.shared/components/workbench/menu/xray/path-ops.js new file mode 100644 index 00000000000..c217e96e212 --- /dev/null +++ b/packages/freesewing.shared/components/workbench/menu/xray/path-ops.js @@ -0,0 +1,76 @@ +import { Chevron } from 'shared/components/navigation/primary.js' +import { Ul, Li, Details, Summary, SumDiv, NoSumDiv, Deg } from 'shared/components/workbench/menu' +import { round } from 'shared/utils.js' +import Point from './point.js' + +const MoveLine = ({ op }) => +const Curve = ({ op }) => ['cp1', 'cp2', 'to'].map(pnt => ( +
  • +
    + + + + {pnt} + + + + +
    +
  • +)) +const Close = () => ( +

    Close

    +) + +const XrayPathOp = ({ op }) => ( +
  • + {op.type === 'close' + ? ( + + + {op.type} + + ) : ( +
    + + + + {op.type} + To + + + +
      + {op.type === 'curve' + ? + : + } +
    +
    + ) + } +
  • +) + +const XrayPathOps = ({ ops=false }) => { + if (!ops || ops.length < 1) return null + + return ( +
  • +
    + + + + PathOps + + + +
      + {ops.map(op => )} +
    +
    +
  • + ) +} + +export default XrayPathOps diff --git a/packages/freesewing.shared/components/workbench/menu/xray/path.js b/packages/freesewing.shared/components/workbench/menu/xray/path.js index 814d1ec6060..3bf2b94f172 100644 --- a/packages/freesewing.shared/components/workbench/menu/xray/path.js +++ b/packages/freesewing.shared/components/workbench/menu/xray/path.js @@ -1,14 +1,26 @@ +import { Ul, Li, Details, Summary, NoSumDiv, Deg } from 'shared/components/workbench/menu' +import ClearIcon from 'shared/components/icons/clear.js' +import Attributes from './attributes.js' +import Ops from './path-ops.js' /* * Things to add * - * attributes * ops - * render */ -const XrayPath = props => { - return
    {JSON.stringify(props.gist.xray.parts[props.partName].paths[props.id], null ,2)}
    -} +const XrayPath = ({ path }) => ( +
      +
    • + + + Render = + {JSON.stringify(path.render)} + +
    • + + +
    +) export default XrayPath diff --git a/packages/freesewing.shared/components/workbench/menu/xray/point.js b/packages/freesewing.shared/components/workbench/menu/xray/point.js index 9f36eb966a4..a1ec440ab70 100644 --- a/packages/freesewing.shared/components/workbench/menu/xray/point.js +++ b/packages/freesewing.shared/components/workbench/menu/xray/point.js @@ -1,9 +1,20 @@ -import { Ul, Li, Details, Summary, SumDiv, Deg } from 'shared/components/workbench/menu' +import { Ul, Li, Details, Summary, NoSumDiv, Deg } from 'shared/components/workbench/menu' +import { round } from 'shared/utils.js' +import Attributes from './attributes.js' -const XrayPoint = props => [ -
  • x: {props.x}
  • , -
  • x: {props.y}
  • , -
  • Attributes: {props.y}
  • , -] +const XrayPoint = ({ point }) => ( +
      + {['x', 'y'].map(coord => ( +
    • + + + {coord} = + {round(point[coord])} + +
    • + ))} + +
    +) export default XrayPoint