1
0
Fork 0

Implement @eriese suggestion

This commit is contained in:
Wouter van Wageningen 2023-04-20 19:14:10 +00:00
parent 0213c92b0f
commit 9536476512
7 changed files with 103 additions and 30 deletions

View file

@ -21,13 +21,21 @@ const defs = [
class="mark"
d="M -1,-5 L 1,-5 L 1,5 L -1,5 z"
/>
</g>
</g>`,
},
{
name: 'buttonhole-start',
def: `
<g id="buttonhole-start">
<path
class="mark"
d="M -1,-10 L 1,-10 L 1,0 L -1,0 z"
/>
</g>
</g>`,
},
{
name: 'buttonhole-end',
def: `
<g id="buttonhole-end">
<path
class="mark"
@ -36,12 +44,16 @@ const defs = [
</g>`,
},
{
name: 'snaps',
name: 'snap-stud-grad',
def: `
<radialGradient id="snap-stud-grad" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
<stop offset="30%" style="stop-color:rgb(235,235,235); stop-opacity:1"/>
<stop offset="80%" style="stop-color:rgb(100,100,100);stop-opacity:1" />
</radialGradient>
</radialGradient>`,
},
{
name: 'snap-stud',
def: `
<g id="snap-stud">
<circle id="snap-stud-circle-edge" cx="0" cy="0" r="3.4"
style="stroke:#666;fill:#dddddd;stroke-width:0.3;"
@ -53,7 +65,11 @@ const defs = [
id="snap-stud-lines" style="fill:none;stroke:#666; stroke-width:0.2;"
d="M -2,0 L -3,0 M 2,0 L 3,0 M 0,2 L 0,3 M 0,-2 L 0,-3 M 1.5,1.5 L 2.1,2.1 M -1.5,1.5 L -2.1,2.1 M -1.5,-1.5 L -2.1,-2.1 M 1.5,-1.5 L 2.1,-2.1"
/>
</g>
</g>`,
},
{
name: 'snap-socket',
def: `
<g id="snap-socket">
<circle id="snap-socket-circle-edge" cx="0" cy="0" r="3.4"
style="stroke:#666;fill:#bbbbbb;stroke-width:0.3;"

View file

@ -1,17 +1,27 @@
const markers = `
const defs = [
{
name: 'cutonfoldFrom',
def: `
<marker orient="auto" refY="4.0" refX="0.0" id="cutonfoldFrom" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="note fill-note" d="M 0,4 L 12,0 C 10,2 10,6 12,8 z" />
</marker>
</marker>`,
},
{
name: 'cutonfoldTo',
def: `
<marker orient="auto" refY="4.0" refX="12.0" id="cutonfoldTo" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="note fill-note" d="M 12,4 L 0,0 C 2,2 2,6 0,8 z" />
</marker>
`
</marker>`,
},
]
// Export hooks
export const cutonfoldHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('cutonfold', markers)
for (const def of defs) {
svg.defs.setIfUnset(def.name, def.def)
}
},
],
}

View file

@ -1,11 +1,20 @@
const markers = `
const defs = [
{
name: 'dimensionFrom',
def: `
<marker orient="auto" refY="4.0" refX="0.0" id="dimensionFrom" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="mark fill-mark" d="M 0,4 L 12,0 C 10,2 10,6 12,8 z" />
</marker>
</marker>`,
},
{
name: 'dimensionTo',
def: `
<marker orient="auto" refY="4.0" refX="12.0" id="dimensionTo" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="mark fill-mark" d="M 12,4 L 0,0 C 2,2 2,6 0,8 z" />
</marker>
`
</marker>`,
},
]
const prefix = '__paperless'
function drawDimension(from, to, so, { Path, units }) {
@ -74,7 +83,9 @@ function lleader(so, type, props, id) {
export const dimensionsHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('dimensions', markers)
for (const def of defs) {
svg.defs.setIfUnset(def.name, def.def)
}
},
],
}

View file

@ -1,10 +1,19 @@
const markers = `
const defs = [
{
name: 'grainlineFrom',
def: `
<marker orient="auto" refY="4.0" refX="10.0" id="grainlineFrom" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="note fill-note" d="M 0,4 L 12,0 C 10,2 10,6 12,8 z" />
</marker>
</marker>`,
},
{
name: 'grainlineTo',
def: `
<marker orient="auto" refY="4.0" refX="2.0" id="grainlineTo" style="overflow:visible;" markerWidth="12" markerHeight="8">
<path class="note fill-note" d="M 12,4 L 0,0 C 2,2 2,6 0,8 z" />
</marker>`
</marker>`,
},
]
const dflts = { text: 'grainline' }
@ -12,7 +21,9 @@ const dflts = { text: 'grainline' }
export const grainlineHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('grainline', markers)
for (const def of defs) {
svg.defs.setIfUnset(def.name, def.def)
}
},
],
}

View file

@ -1,18 +1,29 @@
const markers = `
const defs = [
{
name: 'notch',
def: `
<g id="notch">
<circle cy="0" cx="0" r="1.4" class="fill-note" />
<circle cy="0" cx="0" r="2.8" class="note" />
</g>
</g>`,
},
{
name: 'bnotch',
def: `
<g id="bnotch">
<path d="M -1.1 -1.1 L 1.1 1.1 M 1.1 -1.1 L -1.1 1.1" class="note" />
<circle cy="0" cx="0" r="2.8" class="note" />
</g>`
</g>`,
},
]
// Export hooks
export const notchesHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('notch', markers)
for (const def of defs) {
svg.defs.setIfUnset(def.name, def.def)
}
},
],
}

View file

@ -8,7 +8,7 @@ const markers = `
export const pleatHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('pleat', markers)
svg.defs.setIfUnset('pleatTo', markers)
},
],
}

View file

@ -1,20 +1,34 @@
const markers = `
const defs = [
{
name: 'sewTogetherStart',
def: `
<marker id="sewTogetherStart" markerWidth="4" markerHeight="4" orient="auto" refX="0" refY="2">
<path class="note stroke-sm" d="M4,4 L0,2 4,0" />
</marker>
</marker>`,
},
{
name: 'sewTogetherEnd',
def: `
<marker id="sewTogetherEnd" markerWidth="4" markerHeight="4" orient="auto" refX="4" refY="2">
<path class="note stroke-sm" d="M0,0 L4,2 0,4" />
</marker>
</marker>`,
},
{
name: 'sewTogetherCross',
def: `
<marker id="sewTogetherCross" markerWidth="4" markerHeight="4" orient="auto" refX="2" refY="2">
<path d="M 0,0 L 4,4 M 4,0 L 0,4" class="note stroke-sm"/>
</marker>
`
</marker>`,
},
]
// Export hooks
export const sewtogetherHooks = {
preRender: [
function (svg) {
svg.defs.setIfUnset('sewTogether', markers)
for (const def of defs) {
svg.defs.setIfUnset(def.name, def.def)
}
},
],
}