+ {control > 4 ? null : (
<>
@@ -44,6 +42,7 @@ export const Inspector = ({
{Object.values(inspector.data.show).map((props) => (
))}
+ {control > 4 ?
: null}
>
)
}
diff --git a/sites/shared/components/workbench/views/draft/inspector/path.mjs b/sites/shared/components/workbench/views/draft/inspector/path.mjs
new file mode 100644
index 00000000000..7eb9e0f6d1a
--- /dev/null
+++ b/sites/shared/components/workbench/views/draft/inspector/path.mjs
@@ -0,0 +1,278 @@
+// Components
+import { Path as ShowPath, utils } from 'pkgs/react-components/src/index.mjs'
+import { Attributes, pointCoords, KeyValTable } from './shared.mjs'
+import { round, formatMm } from 'shared/utils.mjs'
+import { TrashIcon, PrintIcon, SearchIcon } from 'shared/components/icons.mjs'
+import { Path as CorePath } from '@freesewing/core'
+
+const { withinPartBounds, getId, getProps } = utils
+
+const CpCircle = ({ point }) => (
+
+)
+
+const EpCircle = ({ point }) => (
+
+)
+
+const InspectCurveOp = ({ op }) => {
+ const from = op.ops[0].to
+ const { cp1, cp2, to } = op.ops[1]
+
+ return (
+ <>
+
+
+
+
+
+
+ >
+ )
+}
+
+const Op = ({ op, len, i }) => (
+
+ {op.type} |
+ {pointCoords(op.to)} |
+ {op.cp1 ? pointCoords(op.cp1) : ''} |
+ {op.cp2 ? pointCoords(op.cp2) : ''} |
+ {len ? formatMm(len) : ''} |
+
+)
+
+const Ops = ({ ops, path }) => (
+
+
+ Type |
+ To |
+ Cp1 |
+ Cp2 |
+ Length |
+
+
+ {path.ops.map((op, i) => {
+ const len = typeof ops[i - 1] === 'undefined' ? 0 : ops[i - 1].length
+ return
+ })}
+
+
+)
+
+const RevealPath = ({ path, pathName, id, inspector }) => (
+
+)
+
+const InspectOp = ({ stackName, pathName, op, i, inspector, t, path }) => {
+ const id = utils.getId({ stackName, pathName, settings: { idPrefix: `pathOp-${i}-` } })
+ const info = {
+ id,
+ title: (
+
+
+ {op.ops[1].type}: {pathName} | {stackName}
+
+
+ ),
+ buttons: [
+
,
+ ],
+ openButtons: [
+
,
+
,
+
,
+ ],
+ children: (
+
+ ),
+ color: 'secondary',
+ }
+
+ return (
+ <>
+ {inspector.data.reveal[id] ? (
+
+ ) : null}
+ {op.ops[1].type === 'curve' ?
: null}
+
inspector.show(info)}
+ />
+ >
+ )
+}
+
+const InspectPath = ({ stackName, pathName, path, part, settings, t, inspector }) => {
+ const classes = path.attributes.list.class
+ if (typeof classes === 'string' && classes.includes('skip-inspector')) return null
+
+ // Pull the instantiated path from the pattern
+ const pathObj = [...inspector.pattern.stacks[stackName].parts][0].paths[pathName]
+ const ops = pathObj.divide().map((p) => {
+ const result = p.asRenderProps()
+ result.length = p.length()
+ const bbox = p.bbox()
+
+ return {
+ ...result,
+ ...bbox,
+ width: bbox.bottomRight.x - bbox.topLeft.x,
+ height: bbox.bottomRight.y - bbox.topLeft.y,
+ }
+ })
+
+ const id = utils.getId({ stackName, pathName, settings: { idPrefix: 'path-' } })
+ const info = {
+ id,
+ title: (
+
+
+ Path: {pathName} | {stackName}
+
+ {path.ops.length} ops
+
+ ),
+ openTitle: (
+
+ Path: {pathName} | {stackName}
+
+ ),
+ buttons: [
+ ,
+ ],
+ openButtons: [
+ ,
+ ,
+ ,
+ ],
+ children: (
+ <>
+ ],
+ [t('topLeft'), pointCoords(path.topLeft)],
+ [t('bottomRight'), pointCoords(path.bottomRight)],
+ [t('width'), formatMm(path.width)],
+ [t('height'), formatMm(path.height)],
+ [t('length'), formatMm(pathObj.length())],
+ ]}
+ />
+
+ >
+ ),
+ color: 'primary',
+ }
+
+ return (
+
+ {inspector.data.reveal[id] ? (
+
+ ) : null}
+ inspector.show(info)}
+ markerStart="none"
+ markerEnd="none"
+ />
+ {ops.map((op, i) => (
+
+ ))}
+
+ )
+}
+
+export const Path = ({
+ stackName,
+ pathName,
+ part,
+ path,
+ settings,
+ components,
+ t,
+ ui,
+ update,
+ inspector,
+}) => (
+ <>
+
+
+ >
+)
diff --git a/sites/shared/components/workbench/views/draft/inspector/pattern.mjs b/sites/shared/components/workbench/views/draft/inspector/pattern.mjs
index 8e39d1adc01..dba80eb351a 100644
--- a/sites/shared/components/workbench/views/draft/inspector/pattern.mjs
+++ b/sites/shared/components/workbench/views/draft/inspector/pattern.mjs
@@ -4,6 +4,7 @@ import { useTranslation } from 'next-i18next'
// Components
import { PanZoomPattern } from 'shared/components/workbench/pan-zoom-pattern.mjs'
import { Point } from './point.mjs'
+import { Path } from './path.mjs'
export const InspectorPattern = (props) => {
const { t } = useTranslation(['workbench'])
@@ -11,6 +12,7 @@ export const InspectorPattern = (props) => {
const components = {
Point: (props) => ,
+ Path: (props) => ,
}
return
diff --git a/sites/shared/components/workbench/views/draft/inspector/point.mjs b/sites/shared/components/workbench/views/draft/inspector/point.mjs
index 0ed904db60d..0a457fc1c82 100644
--- a/sites/shared/components/workbench/views/draft/inspector/point.mjs
+++ b/sites/shared/components/workbench/views/draft/inspector/point.mjs
@@ -1,10 +1,6 @@
-// Hooks
-import { useState, useEffect, useContext } from 'react'
-// Context
-import { ModalContext } from 'shared/context/modal-context.mjs'
// Components
import { Point as ShowPoint, Text, Circle, utils } from 'pkgs/react-components/src/index.mjs'
-import { Tr, KeyTd, ValTd, Attributes, pointCoords, useInfoLoader, KeyValTable } from './shared.mjs'
+import { Attributes, pointCoords, KeyValTable } from './shared.mjs'
import { round } from 'shared/utils.mjs'
import { TrashIcon, PrintIcon, SearchIcon } from 'shared/components/icons.mjs'
@@ -142,21 +138,7 @@ const InspectPoint = ({
)
}
-/*
- title,
- openTitle = false,
- children = [],
- buttons = [],
- top = true,
- bottom = false,
- color = 'primary',
- opened = false,
- toggle = false,
- toggleClasses = '',
- onClick = false,
- openButtons = null,
- className = '',
-*/
+
export const Point = ({
stackName,
pointName,
@@ -169,19 +151,12 @@ export const Point = ({
update,
inspector,
}) => {
- const showInfo = useInfoLoader()
-
// Don't include parts outside the part bounding box
if (!withinPartBounds(point, part)) return null
- const pointProps = { stackName, pointName, part, point, settings, components, t }
-
return (
<>
-
+
{
}
export const KeyValTable = ({ rows }) => (
-
+
{rows.map((row) => (
- {row[0]}: |
- {row[1]} |
+ {row[0]}: |
+ {row[1]} |
))}
@@ -31,7 +31,7 @@ export const KeyValTable = ({ rows }) => (
)
export const pointCoords = (point) =>
- point ? `[ ${round(point.x, 2)}, ${round(point.y, 2)} ]` : null
+ point ? `[${round(point.x, 1)}, ${round(point.y, 1)}]` : null
export const Tr = ({ children }) => {children}
export const KeyTd = ({ children }) => {children}: |
diff --git a/sites/shared/styles/globals.css b/sites/shared/styles/globals.css
index 4ce8c5cc2eb..2003cdb8122 100644
--- a/sites/shared/styles/globals.css
+++ b/sites/shared/styles/globals.css
@@ -278,6 +278,10 @@
fill: currentColor;
animation: pulsefill 3s infinite;
}
+ .pulse-stroke {
+ stroke: currentColor;
+ animation: pulsestroke 3s infinite;
+ }
}
@keyframes pulsefill {
@@ -291,6 +295,17 @@
fill-opacity: 0;
}
}
+@keyframes pulsestroke {
+ 0% {
+ stroke-opacity: 0;
+ }
+ 50% {
+ stroke-opacity: 0.3;
+ }
+ 100% {
+ stroke-opacity: 0;
+ }
+}
/* Override DaisyUI button text color */
.btn-info {