diff --git a/packages/freesewing.shared/components/workbench/default-settings.js b/packages/freesewing.shared/components/workbench/default-settings.js
index cfaaa3d2a32..33ad9828e74 100644
--- a/packages/freesewing.shared/components/workbench/default-settings.js
+++ b/packages/freesewing.shared/components/workbench/default-settings.js
@@ -2,6 +2,7 @@ const defaultSettings = {
sa: 0,
saBool: false,
saMm: 10,
+ scale: 1,
complete: true,
paperless: false,
units: 'metric',
@@ -9,6 +10,8 @@ const defaultSettings = {
margin: 2,
renderer: 'react',
embed: true,
+ debug: true,
+ xray: false,
}
export default defaultSettings
diff --git a/packages/freesewing.shared/components/workbench/draft/index.js b/packages/freesewing.shared/components/workbench/draft/index.js
index a08dbd39206..5532b8375d5 100644
--- a/packages/freesewing.shared/components/workbench/draft/index.js
+++ b/packages/freesewing.shared/components/workbench/draft/index.js
@@ -18,7 +18,7 @@ const tabClasses = active => `
const Wrap = props =>
{props.children}
const LabDraft = props => {
- const { app, pattern, gist, updateGist } = props
+ const { app, pattern, gist, updateGist, unsetGist } = props
const [tab, setTab] = useState(props.pattern.config.name)
@@ -71,12 +71,12 @@ const LabDraft = props => {
{Object.keys(patternProps.parts).map((name) => (
))}
diff --git a/packages/freesewing.shared/components/workbench/draft/part/index.js b/packages/freesewing.shared/components/workbench/draft/part/index.js
index c8425445a09..33223f84cbe 100644
--- a/packages/freesewing.shared/components/workbench/draft/part/index.js
+++ b/packages/freesewing.shared/components/workbench/draft/part/index.js
@@ -3,13 +3,17 @@ import Point from '../point'
import Snippet from '../snippet'
import { getProps } from '../utils'
-const Part = (props) => {
+const raiseEvent = (evt) => console.log('raiseEVent not implemtned', evt)
+
+const Part = props => {
+ const { partName, part, app, gist, updateGist } = props
+
const focusPoint = (point, i) => {
- const p = props.part.points[point]
- const pathString = `M ${p.x} ${props.part.topLeft.y} `
- + `L ${p.x} ${props.part.bottomRight.y} `
- + `M ${props.part.topLeft.x} ${p.y} `
- + `L ${props.part.bottomRight.x} ${p.y} `
+ const p = part.points[point]
+ const pathString = `M ${p.x} ${part.topLeft.y} `
+ + `L ${p.x} ${part.bottomRight.y} `
+ + `M ${part.topLeft.x} ${p.y} `
+ + `L ${part.bottomRight.x} ${p.y} `
const classes = 'focus point c' + (i % 8) // Cycle through 8 colors
return (
@@ -20,8 +24,8 @@ const Part = (props) => {
r="5"
className="contrast"
onClick={() =>
- props.raiseEvent('clearFocus', {
- part: props.name,
+ raiseEvent('clearFocus', {
+ part: partName,
type: 'points',
name: point
})
@@ -32,10 +36,10 @@ const Part = (props) => {
}
const focusCoords = (p, i) => {
- let pathString = `M ${p.x} ${props.part.topLeft.y} `
- pathString += `L ${p.x} ${props.part.bottomRight.y} `
- pathString += `M ${props.part.topLeft.x} ${p.y} `
- pathString += `L ${props.part.bottomRight.x} ${p.y} `
+ let pathString = `M ${p.x} ${part.topLeft.y} `
+ pathString += `L ${p.x} ${part.bottomRight.y} `
+ pathString += `M ${part.topLeft.x} ${p.y} `
+ pathString += `L ${part.bottomRight.x} ${p.y} `
let classes = 'focus coords c' + (i % 4) // Cycle through 4 CSS classes
return (
@@ -46,8 +50,8 @@ const Part = (props) => {
r="5"
className={classes}
onClick={() =>
- props.raiseEvent('clearFocus', {
- part: props.name,
+ raiseEvent('clearFocus', {
+ partName: partName,
type: 'coords',
data: p
})
@@ -57,79 +61,74 @@ const Part = (props) => {
)
}
- let grid = props.paperless ? (
+ let grid = gist.paperless ? (
) : null
let focus = []
- if (props.develop) {
- if (props.focus && typeof props.focus[props.name] !== 'undefined') {
- for (let i in props.focus[props.name].points)
- focus.push(focusPoint(props.focus[props.name].points[i], i))
- for (let i in props.focus[props.name].paths) {
- let name = props.focus[props.name].paths[i]
- focus.push(
-
- props.raiseEvent('clearFocus', {
- part: props.name,
- type: 'paths',
- name
- })
- }
- />
- )
- }
- for (let i in props.focus[props.name].coords)
- focus.push(focusCoords(props.focus[props.name].coords[i], i))
- }
- }
+ //if (gist.debug) {
+ // if (focus && typeof props.focus[props.name] !== 'undefined') {
+ // for (let i in props.focus[props.name].points)
+ // focus.push(focusPoint(props.focus[props.name].points[i], i))
+ // for (let i in props.focus[props.name].paths) {
+ // let name = props.focus[props.name].paths[i]
+ // focus.push(
+ //
+ // props.raiseEvent('clearFocus', {
+ // part: props.name,
+ // type: 'paths',
+ // name
+ // })
+ // }
+ // />
+ // )
+ // }
+ // for (let i in props.focus[props.name].coords)
+ // focus.push(focusCoords(props.focus[props.name].coords[i], i))
+ // }
+ //}
return (
-
+
{grid}
- {Object.keys(props.part.paths).map((name) => (
+ {Object.keys(part.paths).map((pathName) => (
))}
{Object.keys(props.part.points).map((name) => (
))}
- {Object.keys(props.part.snippets).map((name) => (
-
+ {Object.keys(props.part.snippets).map((snippetName) => (
+
))}
{focus}
diff --git a/packages/freesewing.shared/components/workbench/draft/path/index.js b/packages/freesewing.shared/components/workbench/draft/path/index.js
index 2a1f6f33258..d9c446d1768 100644
--- a/packages/freesewing.shared/components/workbench/draft/path/index.js
+++ b/packages/freesewing.shared/components/workbench/draft/path/index.js
@@ -1,15 +1,16 @@
import TextOnPath from '../text-on-path'
import { getProps } from '../utils'
-const Path = (props) => {
- if (!props.path.render) return null
+const Path = props => {
+ const { path, part, name } = props
+ if (!path.render) return null
const output = []
- const pathId = 'path-' + props.part + '-' + props.name
+ const pathId = 'path-' + part + '-' + name
output.push(
-
+
)
- if (props.path.attributes.get('data-text'))
- output.push()
+ if (path.attributes.get('data-text'))
+ output.push()
return output
}
diff --git a/packages/freesewing.shared/components/workbench/draft/point/index.js b/packages/freesewing.shared/components/workbench/draft/point/index.js
index 88e5a290460..895489f6739 100644
--- a/packages/freesewing.shared/components/workbench/draft/point/index.js
+++ b/packages/freesewing.shared/components/workbench/draft/point/index.js
@@ -1,12 +1,35 @@
import Text from '../text'
import Circle from '../circle'
-const Point = (props) => {
+const XrayPoint = props => (
+
+
+ props.updateGist(
+ ['xray', parts, 'props.partName', 'points', props.name],
+ props.point
+ )}
+ />
+
+)
+
+
+const Point = props => {
+ const { point, name } = props
const output = []
- if (props.point.attributes && props.point.attributes.get('data-text'))
- output.push()
- if (props.point.attributes && props.point.attributes.get('data-circle'))
- output.push()
+ if (props.gist.xray) output.push()
+ if (point.attributes && point.attributes.get('data-text'))
+ output.push()
+ if (point.attributes && point.attributes.get('data-circle'))
+ output.push()
return output.length < 1 ? null : output
}
diff --git a/packages/freesewing.shared/components/workbench/menu/core-settings/core-setting-nr.js b/packages/freesewing.shared/components/workbench/menu/core-settings/core-setting-nr.js
new file mode 100644
index 00000000000..a4ed544c03e
--- /dev/null
+++ b/packages/freesewing.shared/components/workbench/menu/core-settings/core-setting-nr.js
@@ -0,0 +1,69 @@
+import { useState } from 'react'
+import ClearIcon from 'shared/components/icons/clear.js'
+import EditIcon from 'shared/components/icons/edit.js'
+
+const CoreSettingNr = props => {
+ const { dflt, min, max } = props
+ const val = props.gist?.[props.setting]
+
+ const [value, setValue] = useState(val)
+
+ const handleChange = evt => {
+ const newVal = parseFloat(evt.target.value)
+
+ if (newVal === dflt) reset()
+ else {
+ setValue(newVal)
+ props.updateGist([props.setting], newVal)
+ }
+ }
+ const reset = () => {
+ setValue(props.dflt)
+ props.updateGist([props.setting], props.dflt)
+ }
+
+
+ return (
+
+
+ {props.app.t(`settings.${props.setting}.description`)}
+
+
+
+ {min}
+
+
+ {val}
+
+
+ {max}
+
+
+
+
+
+
+
+
+ )
+}
+
+export default CoreSettingNr
diff --git a/packages/freesewing.shared/components/workbench/menu/core-settings/index.js b/packages/freesewing.shared/components/workbench/menu/core-settings/index.js
index 4d23f014cb3..2a67f9a102c 100644
--- a/packages/freesewing.shared/components/workbench/menu/core-settings/index.js
+++ b/packages/freesewing.shared/components/workbench/menu/core-settings/index.js
@@ -29,6 +29,11 @@ const settings = {
max: 25,
dflt: 2,
},
+ scale: {
+ min: 0.1,
+ max: 5,
+ dflt: 1,
+ },
renderer: {
list: ['react', 'svg'],
titles: {
@@ -39,6 +44,9 @@ const settings = {
debug: {
dflt: false,
},
+ xray: {
+ dflt: false,
+ },
}
const CoreSettings = props => {
diff --git a/packages/freesewing.shared/components/workbench/menu/core-settings/setting.js b/packages/freesewing.shared/components/workbench/menu/core-settings/setting.js
index 7d45ba69580..d28d0e9e109 100644
--- a/packages/freesewing.shared/components/workbench/menu/core-settings/setting.js
+++ b/packages/freesewing.shared/components/workbench/menu/core-settings/setting.js
@@ -4,6 +4,7 @@ import CountOption from 'shared/components/workbench/inputs/design-option-count'
import ListSetting from './core-setting-list'
import OnlySetting from './core-setting-only'
import MmSetting from './core-setting-mm'
+import NrSetting from './core-setting-nr'
import BoolSetting from './core-setting-bool.js'
import SaBoolSetting from './core-setting-sa-bool.js'
import SaMmSetting from './core-setting-sa-mm.js'
@@ -52,6 +53,9 @@ const settings = {
}} />
)
},
+ scale: props => props.gist.scale === 1
+ ? {props.gist.scale}
+ : {props.gist.scale},
saMm: props => {
return (
,
margin: props => ,
+ scale: props => ,
saMm: props => ,
renderer: props => {
if (props.setting === 'saBool')
return
- if (['paperless', 'complete', 'debug'].indexOf(props.setting) !== -1)
+ if (['paperless', 'complete', 'debug', 'xray'].indexOf(props.setting) !== -1)
return
const Input = inputs[props.setting]
diff --git a/packages/freesewing.shared/styles/globals.css b/packages/freesewing.shared/styles/globals.css
index 096131ad6d2..e419a9baa5f 100644
--- a/packages/freesewing.shared/styles/globals.css
+++ b/packages/freesewing.shared/styles/globals.css
@@ -35,21 +35,37 @@
.fs-stroke-contrast { stroke: var(--pattern-contrast); }
.fs-stroke-note { stroke: var(--pattern-note); }
svg.freesewing.pattern path.fabric,
- svg.freesewing.pattern circle.fabric { @apply fs-stroke-fabric }
+ svg.freesewing.pattern path.stroke-fabric,
+ svg.freesewing.pattern circle.fabric,
+ svg.freesewing.pattern circle.stroke-fabric { @apply fs-stroke-fabric }
svg.freesewing.pattern path.lining,
- svg.freesewing.pattern circle.lining { @apply fs-stroke-lining }
+ svg.freesewing.pattern path.stroke-lining,
+ svg.freesewing.pattern circle.lining,
+ svg.freesewing.pattern circle.stroke-lining { @apply fs-stroke-lining }
svg.freesewing.pattern path.interfacing,
- svg.freesewing.pattern circle.interfacing { @apply fs-stroke-interfacing }
+ svg.freesewing.pattern path.stroke-interfacing,
+ svg.freesewing.pattern circle.interfacing,
+ svg.freesewing.pattern circle.stroke-interfacing { @apply fs-stroke-interfacing }
svg.freesewing.pattern path.canvas,
- svg.freesewing.pattern circle.canvas { @apply fs-stroke-canvas }
+ svg.freesewing.pattern path.stroke-canvas,
+ svg.freesewing.pattern circle.canvas,
+ svg.freesewing.pattern circle.stroke-canvas { @apply fs-stroke-canvas }
svg.freesewing.pattern path.various,
- svg.freesewing.pattern circle.various { @apply fs-stroke-various }
+ svg.freesewing.pattern path.stroke-various,
+ svg.freesewing.pattern circle.various,
+ svg.freesewing.pattern circle.stroke-various { @apply fs-stroke-various }
svg.freesewing.pattern path.mark,
- svg.freesewing.pattern circle.mark { @apply fs-stroke-mark }
+ svg.freesewing.pattern path.stroke-mark,
+ svg.freesewing.pattern circle.mark,
+ svg.freesewing.pattern circle.stroke-mark { @apply fs-stroke-mark }
svg.freesewing.pattern path.contrast,
- svg.freesewing.pattern circle.contrast { @apply fs-stroke-contrast }
+ svg.freesewing.pattern path.stroke-contrast,
+ svg.freesewing.pattern circle.contrast,
+ svg.freesewing.pattern circle.stroke-contrast { @apply fs-stroke-contrast }
svg.freesewing.pattern path.note,
- svg.freesewing.pattern circle.note { @apply fs-stroke-note }
+ svg.freesewing.pattern path.stroke-note,
+ svg.freesewing.pattern circle.note,
+ svg.freesewing.pattern circle.stroke-note { @apply fs-stroke-note }
.fs-fill-fabric { fill: var(--pattern-fabric); }
.fs-fill-lining { fill: var(--pattern-lining); }
.fs-fill-interfacing { fill: var(--pattern-interfacing); }
@@ -95,6 +111,8 @@
.fs-fill-current { fill: currentColor; }
svg.freesewing.pattern .fill-bg { @apply fs-fill-bg }
svg.freesewing.pattern .fill-current { @apply fs-fill-current }
+ .fill-opacity-25 { fill-opacity: 0.25; }
+ .fill-opacity-50 { fill-opacity: 0.5; }
}
/* Override DaisyUI button text color */