diff --git a/plugins/plugin-annotations/src/buttons.mjs b/plugins/plugin-annotations/src/buttons.mjs index 6c54b94d8ca..690a0ce56f5 100644 --- a/plugins/plugin-annotations/src/buttons.mjs +++ b/plugins/plugin-annotations/src/buttons.mjs @@ -21,13 +21,21 @@ const defs = [ class="mark" d="M -1,-5 L 1,-5 L 1,5 L -1,5 z" /> - +`, + }, + { + name: 'buttonhole-start', + def: ` - +`, + }, + { + name: 'buttonhole-end', + def: ` `, }, { - name: 'snaps', + name: 'snap-stud-grad', def: ` - +`, + }, + { + name: 'snap-stud', + def: ` - +`, + }, + { + name: 'snap-socket', + def: ` - +`, + }, + { + name: 'cutonfoldTo', + def: ` - -` +`, + }, +] // 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) + } }, ], } diff --git a/plugins/plugin-annotations/src/dimensions.mjs b/plugins/plugin-annotations/src/dimensions.mjs index 3e975eb0aca..53a6032d653 100644 --- a/plugins/plugin-annotations/src/dimensions.mjs +++ b/plugins/plugin-annotations/src/dimensions.mjs @@ -1,11 +1,20 @@ -const markers = ` +const defs = [ + { + name: 'dimensionFrom', + def: ` - +`, + }, + { + name: 'dimensionTo', + def: ` - -` +`, + }, +] + 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) + } }, ], } diff --git a/plugins/plugin-annotations/src/grainline.mjs b/plugins/plugin-annotations/src/grainline.mjs index d04267b3bde..d7933d5b79c 100644 --- a/plugins/plugin-annotations/src/grainline.mjs +++ b/plugins/plugin-annotations/src/grainline.mjs @@ -1,10 +1,19 @@ -const markers = ` +const defs = [ + { + name: 'grainlineFrom', + def: ` - +`, + }, + { + name: 'grainlineTo', + def: ` -` +`, + }, +] 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) + } }, ], } diff --git a/plugins/plugin-annotations/src/notches.mjs b/plugins/plugin-annotations/src/notches.mjs index e7e33561de4..f04f5c94317 100644 --- a/plugins/plugin-annotations/src/notches.mjs +++ b/plugins/plugin-annotations/src/notches.mjs @@ -1,18 +1,29 @@ -const markers = ` +const defs = [ + { + name: 'notch', + def: ` - +`, + }, + { + name: 'bnotch', + def: ` -` +`, + }, +] // 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) + } }, ], } diff --git a/plugins/plugin-annotations/src/pleat.mjs b/plugins/plugin-annotations/src/pleat.mjs index cc0ce01eb44..3fe463455f0 100644 --- a/plugins/plugin-annotations/src/pleat.mjs +++ b/plugins/plugin-annotations/src/pleat.mjs @@ -8,7 +8,7 @@ const markers = ` export const pleatHooks = { preRender: [ function (svg) { - svg.defs.setIfUnset('pleat', markers) + svg.defs.setIfUnset('pleatTo', markers) }, ], } diff --git a/plugins/plugin-annotations/src/sewtogether.mjs b/plugins/plugin-annotations/src/sewtogether.mjs index 54ecb06ee7f..d17c5cebd44 100644 --- a/plugins/plugin-annotations/src/sewtogether.mjs +++ b/plugins/plugin-annotations/src/sewtogether.mjs @@ -1,20 +1,34 @@ -const markers = ` +const defs = [ + { + name: 'sewTogetherStart', + def: ` - +`, + }, + { + name: 'sewTogetherEnd', + def: ` - +`, + }, + { + name: 'sewTogetherCross', + def: ` - -` +`, + }, +] // 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) + } }, ], }