render pageless grid on pdf exports if pageless is on
This commit is contained in:
parent
4bdbddb3d6
commit
e1f7de0209
9 changed files with 129 additions and 115 deletions
|
@ -1,37 +1,41 @@
|
|||
export const paperlessStyle = `
|
||||
/* Paperless grid */
|
||||
svg.freesewing path.grid {
|
||||
fill: none;
|
||||
export const paperlessStyle = (stripped) => `
|
||||
${!stripped ? '/* Paperless grid */' : ''}
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.grid {
|
||||
stroke: #555;
|
||||
stroke-width: 0.3;
|
||||
}
|
||||
svg.freesewing path.gridline {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.gridline {
|
||||
stroke: #555;
|
||||
stroke-width: 0.2;
|
||||
fill: none;
|
||||
}
|
||||
svg.freesewing path.gridline-lg {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.gridline-lg {
|
||||
stroke: #777;
|
||||
stroke-width: 0.2;
|
||||
stroke-dasharray: 1.5,1.5;
|
||||
fill: none;
|
||||
}
|
||||
svg.freesewing path.gridline-sm {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.gridline-sm {
|
||||
stroke: #999;
|
||||
stroke-width: 0.1;
|
||||
fill: none;
|
||||
}
|
||||
svg.freesewing path.gridline-xs {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.gridline-xs {
|
||||
stroke: #999;
|
||||
stroke-width: 0.1;
|
||||
stroke-dasharray: 0.5,0.5;
|
||||
fill: none;
|
||||
}
|
||||
svg.freesewing path.gridbox {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.gridbox {
|
||||
fill: url(#grid);
|
||||
}`
|
||||
export const sampleStyle = `
|
||||
/* Sample classes */
|
||||
svg.freesewing path.sample {
|
||||
|
||||
export const sampleStyle = (stripped) => `
|
||||
${!stripped ? '/* Sample classes */' : ''}
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.sample {
|
||||
stroke-width: 0.75
|
||||
}
|
||||
svg.freesewing path.sample-focus {
|
||||
${!stripped ? 'svg.freesewing ' : ''}path.sample-focus {
|
||||
stroke-width: 1.5; fill: rgba(0,0,0,0.1)
|
||||
}`
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ export const plugin = {
|
|||
const current = svg.attributes.get('class')
|
||||
if (!current || current.indexOf('freesewing') !== -1) {
|
||||
svg.attributes.set('class', 'freesewing')
|
||||
svg.style += sampleStyle
|
||||
svg.style += paperlessStyle
|
||||
svg.style += sampleStyle(data.stripped)
|
||||
svg.style += paperlessStyle(data.stripped)
|
||||
svg.style += buildStylesheet(svg.pattern.settings.scale, data.stripped)
|
||||
let paperless = false
|
||||
for (const set of svg.pattern.settings) {
|
||||
|
@ -40,10 +40,10 @@ export const plugin = {
|
|||
? (svg.defs += grid.imperial)
|
||||
: (svg.defs += grid.metric)
|
||||
const parts = svg.pattern.parts[svg.pattern.activeSet]
|
||||
const skip = data.skipGrid || []
|
||||
const skipGrid = data.skipGrid || []
|
||||
for (const key in parts) {
|
||||
const part = parts[key]
|
||||
if (!part.hidden && !data.skipGrid.includes(key) && svg.pattern.__needs(key)) {
|
||||
if (!part.hidden && !skipGrid.includes(key) && svg.pattern.__needs(key)) {
|
||||
const { Path, paths, getId, Point, points } = part.shorthand()
|
||||
let anchor = new Point(0, 0)
|
||||
if (typeof points.gridAnchor !== 'undefined') anchor = part.points.gridAnchor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue