diff --git a/sites/shared/components/modal.js b/sites/shared/components/modal.js
new file mode 100644
index 00000000000..58fff8eb661
--- /dev/null
+++ b/sites/shared/components/modal.js
@@ -0,0 +1,22 @@
+import { useState } from 'react'
+
+const Modal = ({ cancel, children }) => {
+
+
+ return (
+
+ )
+}
+
+export default Modal
diff --git a/sites/shared/components/workbench/draft/index.js b/sites/shared/components/workbench/draft/index.js
index 3089077bbed..f80ab7e1ee8 100644
--- a/sites/shared/components/workbench/draft/index.js
+++ b/sites/shared/components/workbench/draft/index.js
@@ -3,7 +3,7 @@ import Error from './error.js'
import Robot from 'shared/components/robot/index.js'
const LabDraft = props => {
- const { app, draft, design, gist, updateGist, unsetGist, feedback } = props
+ const { app, draft, design, gist, updateGist, unsetGist, showInfo, feedback } = props
if (!draft) return null
@@ -32,7 +32,7 @@ const LabDraft = props => {
?
: null
}
-
+
>
)
}
diff --git a/sites/shared/components/workbench/draft/path/index.js b/sites/shared/components/workbench/draft/path/index.js
index 23089794394..b33b3c2f51b 100644
--- a/sites/shared/components/workbench/draft/path/index.js
+++ b/sites/shared/components/workbench/draft/path/index.js
@@ -1,21 +1,436 @@
-import React from 'react'
+import React, { useState } from 'react'
import TextOnPath from '../text-on-path'
import { getProps } from '../utils'
+import { round } from 'shared/utils'
-const XrayPath = props => (
-
+const pointInfo = point => point
+ ? `[ ${round(point.x, 2)}, ${round(point.y, 2)} ]`
+ : null
+
+const Tr = ({ children }) => {children}
+const KeyTd = ({ children }) => {children}: |
+const ValTd = ({ children }) => {children} |
+
+const TextAlongPath = ({id, size, fill="var(--pattern-note)", txt}) => (
+
+
+
+ {txt}
+
+
+
+)
+const PointCircle = ({ point, size, className="stroke-neutral-content" }) => (
+
+)
+
+const pathDimensions = (from, to, cp1=false, cp2=false, path=false) => {
+ const topLeft = {
+ x: (to.x < from.x) ? to.x : from.x,
+ y: (to.y < from.y) ? to.y : from.y,
+ }
+ const bottomRight = {
+ x: (to.x > from.x) ? to.x : from.x,
+ y: (to.y > from.y) ? to.y : from.y,
+ }
+ let bbox = false
+ // Deal with curves
+ if (cp1 && cp2) {
+ if (cp1.x < topLeft.x) topLeft.x = cp1.x
+ if (cp2.x < topLeft.x) topLeft.x = cp2.x
+ if (cp1.x > bottomRight.x) bottomRight.x = cp1.x
+ if (cp2.x > bottomRight.x) bottomRight.x = cp2.x
+ if (cp1.y < topLeft.y) topLeft.y = cp1.y
+ if (cp2.y < topLeft.y) topLeft.y = cp2.y
+ if (cp1.y > bottomRight.y) bottomRight.y = cp1.y
+ if (cp2.y > bottomRight.y) bottomRight.y = cp2.y
+ // This undocumented core methods returns the curve's bounding box
+ bbox = path.boundary()
+ }
+ const w = bottomRight.x - topLeft.x
+ const h = bottomRight.y - topLeft.y
+ const size = w > h ? w : h
+
+ return {
+ topLeft,
+ bottomRight,
+ w,
+ h,
+ size,
+ bbox
+ }
+}
+
+const Defs = () => (
+
+
+
+
+
+
+
+
+)
+
+const svgProps = {
+ xmlns: "http://www.w3.org/2000/svg",
+ xmlnsSvg: "http://www.w3.org/2000/svg",
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
+ style: { maxHeight: 'inherit', strokeLinecap: 'round', strokeLinejoin: 'round' },
+}
+
+const Line = (props) => {
+ const ops = props.path.ops
+ const from = ops[0].to
+ const to = ops[1].to
+ const { topLeft, bottomRight, w, h, size } = pathDimensions(from, to)
+ const id = `${props.partName}_${props.pathName}_${props.i}`
+
+ const xyProps = {
+ className: "stroke-neutral-content",
+ strokeOpacity: "0.5",
+ fill: "none",
+ strokeWidth: (size/300),
+ }
+
+ return (
+
+ )
+}
+
+const Curve = (props) => {
+ const ops = props.path.ops
+ const from = ops[0].to
+ const { to, cp1, cp2 } = ops[1]
+ const { topLeft, bottomRight, w, h, size, bbox } = pathDimensions(from, to, cp1, cp2, props.path)
+ const id = `${props.partName}_${props.pathName}_${props.i}`
+
+ const cpProps = {
+ className: "stroke-success",
+ strokeOpacity: "0.85",
+ fill: "none",
+ strokeWidth: (size/300),
+ }
+ const xyProps = {
+ ...cpProps,
+ strokeOpacity: "0.5",
+ className: "stroke-neutral-content",
+ markerEnd: "url(#arrowTo)",
+ markerStart: "url(#arrowFrom)",
+ }
+
+ return (
+
+ )
+}
+
+const MiniPath = props => {
+ const ops = props.path.ops
+ const bbox = props.path.boundary()
+ const id = `${props.partName}_${props.pathName}_mini}`
+ const w = bbox.bottomRight.x - bbox.topLeft.x
+ const h = bbox.bottomRight.y - bbox.topLeft.y
+ const size = w > h ? w : h
+
+ const xyProps = {
+ fill: "none",
+ strokeWidth: (size/300),
+ strokeOpacity: "0.5",
+ className: "stroke-neutral-content",
+ markerEnd: "url(#arrowTo)",
+ markerStart: "url(#arrowFrom)",
+ }
+
+ return (
+
+ )
+}
+
+const lineInfo = (props) => (
+
+
Line info
+
+
+
+
+ From
+ {pointInfo(props.path.ops[0].to)}
+
+
+ To
+ {pointInfo(props.path.ops[1].to)}
+
+
+ Length
+ {round(props.path.length(), 2)}mm
+
+
+ Part
+ {props.partName}
+
+
+ Draw Op
+ {props.i}/{props.ops.length}
+
+
+
+
+
+
+
+
+)
+
+const XrayLine = props => (
+ <>
props.updateGist(
- ['_state', 'xray', 'parts', props.partName, 'paths', props.pathName],
- 1
- )}
+ className="opacity-0 stroke-4xl stroke-note hover:opacity-25 hover:cursor-pointer"
+ onClick={(evt) => { evt.stopPropagation(); props.showInfo(lineInfo(props)) }}
/>
-
+ >
)
+const curveInfo = (props) => (
+
+
Curve info
+
+
+
+
+ From
+ {pointInfo(props.path.ops[0].to)}
+
+
+ Cp1
+ {pointInfo(props.path.ops[1].cp1)}
+
+
+ Cp2
+ {pointInfo(props.path.ops[1].cp2)}
+
+
+ To
+ {pointInfo(props.path.ops[1].to)}
+
+
+ Length
+ {round(props.path.length(), 2)}mm
+
+
+ Part
+ {props.partName}
+
+
+ Draw Op
+ {props.i}/{props.ops.length}
+
+
+
+
+
+
+
+
+)
+
+const Attributes = ({ list }) => list
+ ? (
+
+ {Object.keys(list).map(key => (
+ - {key}: {list[key]}
+ ))}
+
+ ) : null
+
+const pathInfo = (props) => {
+ const bbox = props.path.boundary()
+
+ return (
+
+
Path info
+
+
+
+
+ Name
+ {bbox.name}
+
+
+ Length
+ {round(props.path.length(), 2)}mm
+
+
+ Width
+ {round(bbox.bottomRight.x - bbox.topLeft.x, 2)}mm
+
+
+ Height
+ {round(bbox.bottomRight.y - bbox.topLeft.y, 2)}mm
+
+
+ Top Left
+ {pointInfo(bbox.topLeft)}
+
+
+ Bottom Right
+ {pointInfo(bbox.bottomRight)}
+
+
+ Part
+ {props.partName}
+
+
+ Attributes
+
+
+
+
+
+
+ {props.path.ops.map((op, i) => (
+
+ {i}
+
+
+ ))}
+
+
+
+
+
+
+
+ )
+}
+
+const PathOp = ({ op }) => {
+ if (op.type === 'move') return Move to {pointInfo(op.to)}
+ else if (op.type === 'line') return Line to {pointInfo(op.to)}
+ else if (op.type === 'curve') return (
+
+ Curve to {pointInfo(op.to)}
+
+ Cp1: {pointInfo(op.cp1)}
+
+ Cp2: {pointInfo(op.cp2)}
+
+ )
+ else if (op.type === 'noop') return NOOP
+ else if (op.type === 'close') return Close
+ else return FIXME: unknown path operation type: {op.type}
+}
+
+const XrayCurve = props => (
+ { evt.stopPropagation(); props.showInfo(curveInfo(props)) }}
+ />
+)
+
+const XrayPath = props => {
+ const ops = props.path.divide()
+
+ return (
+
+ { evt.preventDefault(); props.showInfo(pathInfo(props)) }}
+ />
+ {ops.length > 1
+ ? ops.map((op,i) => (op.ops[1].type === 'curve')
+ ?
+ :
+ ) : null
+ }
+
+ )
+}
+
const Path = props => {
const { path, partName, pathName } = props
diff --git a/sites/shared/components/workbench/draft/svg-wrapper.js b/sites/shared/components/workbench/draft/svg-wrapper.js
index 97cf95861d5..6f276f02cff 100644
--- a/sites/shared/components/workbench/draft/svg-wrapper.js
+++ b/sites/shared/components/workbench/draft/svg-wrapper.js
@@ -26,7 +26,7 @@ import Part from './part'
*/
const SvgWrapper = props => {
- const { patternProps, gist, app, updateGist, unsetGist } = props
+ const { patternProps, gist, app, updateGist, unsetGist, showInfo } = props
return {({ size }) => (
{
{Object.keys(patternProps.parts).map((name) => (
-
+ AltMenu: ,
+ showInfo: setPopup,
}
+ console.log(popup)
// Layout to use
const LayoutComponent = layout
@@ -145,6 +149,7 @@ const WorkbenchWrapper = ({ app, design, preload=false, from=false, layout=false
return
{messages}
+ {popup && setPopup(false)}>{popup}}
}
diff --git a/sites/shared/styles/svg-freesewing-draft.css b/sites/shared/styles/svg-freesewing-draft.css
index ad158cc0b32..42170eec426 100644
--- a/sites/shared/styles/svg-freesewing-draft.css
+++ b/sites/shared/styles/svg-freesewing-draft.css
@@ -2,6 +2,7 @@ svg.freesewing.pattern {
/* Don't let the SVG surpass the parent container */
max-width: 100%;
+ max-height: 100%;
/* Reset */
path, circle { fill: none; stroke: none; }
@@ -25,6 +26,9 @@ svg.freesewing.pattern {
.stroke-3xl { stroke-width: calc(var(--pattern-stroke-3xl) * var(--pattern-scale)); }
.stroke-4xl { stroke-width: calc(var(--pattern-stroke-4xl) * var(--pattern-scale)); }
.stroke-5xl { stroke-width: calc(var(--pattern-stroke-5xl) * var(--pattern-scale)); }
+ .stroke-6xl { stroke-width: calc(var(--pattern-stroke-6xl) * var(--pattern-scale)); }
+ .stroke-7xl { stroke-width: calc(var(--pattern-stroke-7xl) * var(--pattern-scale)); }
+ .stroke-8xl { stroke-width: calc(var(--pattern-stroke-8xl) * var(--pattern-scale)); }
/* Stroke dasharray utility classes */
.sa { stroke-dasharray: 1, 3; }
diff --git a/sites/shared/themes/dark.js b/sites/shared/themes/dark.js
index 0197accf3fd..9e81e9b8aab 100644
--- a/sites/shared/themes/dark.js
+++ b/sites/shared/themes/dark.js
@@ -1,7 +1,8 @@
const colors = require('tailwindcss/colors')
+const light = require('./light')
module.exports = {
- 'fontFamily': '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif',
+ ...light, // Startr from defaults, so we don't miss anything
'primary': colors.violet['700'],
'primary-focus': colors.violet['600'],
'primary-content': colors.violet['50'],
@@ -82,23 +83,4 @@ module.exports = {
'--pattern-dev-5': colors.violet['500'],
'--pattern-dev-6': colors.teal['500'],
'--pattern-dev-7': colors.neutral['500'],
-
- '--pattern-text-xs': '0.2rem',
- '--pattern-text-sm': '0.3rem',
- '--pattern-text': '0.4rem',
- '--pattern-text-lg': '0.6rem',
- '--pattern-text-xl': '0.8rem',
- '--pattern-text-2xl': '1.5rem',
- '--pattern-text-3xl': '2rem',
- '--pattern-text-4xl': '3rem',
-
- '--pattern-scale': '1',
- '--pattern-stroke-xs': "0.2px",
- '--pattern-stroke-sm': "0.4px",
- '--pattern-stroke': "0.7px",
- '--pattern-stroke-lg': "1.3px",
- '--pattern-stroke-xl': "2px",
- '--pattern-stroke-2xl': "4px",
- '--pattern-stroke-3xl': "6px",
- '--pattern-stroke-4xl': "8px",
}
diff --git a/sites/shared/themes/hax0r.js b/sites/shared/themes/hax0r.js
index 1a28587ac06..a5aa626e872 100644
--- a/sites/shared/themes/hax0r.js
+++ b/sites/shared/themes/hax0r.js
@@ -1,7 +1,9 @@
const colors = require('tailwindcss/colors')
+const light = require('./light')
const bg = '#002808'
module.exports = {
+ ...light, // Startr from defaults, so we don't miss anything
'fontFamily': `ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;`,
'primary': colors.lime['700'],
'primary-focus': colors.lime['600'],
diff --git a/sites/shared/themes/lgbtq.js b/sites/shared/themes/lgbtq.js
index fda2071b031..1025f343b66 100644
--- a/sites/shared/themes/lgbtq.js
+++ b/sites/shared/themes/lgbtq.js
@@ -1,4 +1,5 @@
const colors = require('tailwindcss/colors')
+const light = require('./light')
module.exports = {
'fontFamily': '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif',
diff --git a/sites/shared/themes/light.js b/sites/shared/themes/light.js
index 97ffefb18d0..c777978e23f 100644
--- a/sites/shared/themes/light.js
+++ b/sites/shared/themes/light.js
@@ -251,4 +251,10 @@ module.exports = {
'--pattern-stroke-3xl': "6px",
// Pattern 4xl stroke width
'--pattern-stroke-4xl': "8px",
+ // Pattern 5xl stroke width
+ '--pattern-stroke-5xl': "12px",
+ // Pattern 6xl stroke width
+ '--pattern-stroke-6xl': "16px",
+ // Pattern 7xl stroke width
+ '--pattern-stroke-7xl': "20px",
}
diff --git a/sites/shared/themes/trans.js b/sites/shared/themes/trans.js
index a51ccd20ec5..92b80fe5e7a 100644
--- a/sites/shared/themes/trans.js
+++ b/sites/shared/themes/trans.js
@@ -1,4 +1,5 @@
const colors = require('tailwindcss/colors')
+const light = require('./light')
const blue = '#77cbf9'
const pink = '#ecadb9'