1
0
Fork 0

chore(rendertest): Make it prettier

This commit is contained in:
Joost De Cock 2022-01-19 16:23:13 +01:00
parent b1647a7371
commit ca4c0b5bae
10 changed files with 97 additions and 104 deletions

View file

@ -13,17 +13,7 @@ export default {
content: ['only'], content: ['only'],
}, },
measurements: [], measurements: [],
parts: [ parts: ['demo', 'circles', 'colors', 'widths', 'styles', 'combos', 'text', 'snippets', 'macros'],
'demo',
'circles',
'colors',
'widths',
'styles',
'combos',
'text',
'snippets',
'macros',
],
options: { options: {
width: { mm: 200, min: 50, max: 500, testIgnore: true }, width: { mm: 200, min: 50, max: 500, testIgnore: true },
strokeColors: { bool: true }, strokeColors: { bool: true },
@ -46,7 +36,7 @@ export default {
'text', 'text',
'snippets', 'snippets',
'macros', 'macros',
] ],
} },
}, },
} }

View file

@ -2,7 +2,6 @@ export default function (part, demo=false) {
const { Point, Path, points, paths, store, options } = part.shorthand() const { Point, Path, points, paths, store, options } = part.shorthand()
if (options.only === 'circles' || demo) { if (options.only === 'circles' || demo) {
let y = store.get('y') let y = store.get('y')
const w = store.get('w') const w = store.get('w')
let colors = store.get('colors') let colors = store.get('colors')
@ -12,12 +11,23 @@ export default function (part, demo=false) {
points[`circles1-${i}`] = new Point(w / 3 - w / 6, y) points[`circles1-${i}`] = new Point(w / 3 - w / 6, y)
.attr('data-circle', i * (w / 50)) .attr('data-circle', i * (w / 50))
.attr('data-circle-class', store.get('colors')[i]) .attr('data-circle-class', store.get('colors')[i])
points[`circles2-${i}`] = new Point(w/3*2 - w/6, y) points[`circles2-${i}`] = new Point((w / 3) * 2 - w / 6, y)
.attr('data-circle', i * (w / 50)) .attr('data-circle', i * (w / 50))
.attr('data-circle-class', 'fabric ' + store.get('styles')[i] + ' ' + store.get('colors')[i]) .attr(
'data-circle-class',
'fabric ' + store.get('styles')[i] + ' ' + store.get('colors')[i]
)
points[`circles3-${i}`] = new Point(w - w / 6, y) points[`circles3-${i}`] = new Point(w - w / 6, y)
.attr('data-circle', i * (w / 50)) .attr('data-circle', i * (w / 50))
.attr('data-circle-class', 'fabric ' + store.get('widths')[i] + ' ' + store.get('styles')[i] + ' ' + store.get('colors')[i]) .attr(
'data-circle-class',
'fabric ' +
store.get('widths')[i] +
' ' +
store.get('styles')[i] +
' ' +
store.get('colors')[i]
)
} }
y += w / 8 y += w / 8
store.set('y', y) store.set('y', y)

View file

@ -7,7 +7,8 @@ export default function (part, demo=false) {
// Stroke colors // Stroke colors
y += 10 y += 10
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')

View file

@ -7,7 +7,8 @@ export default function (part, demo=false) {
// Stroke combos // Stroke combos
y += 25 y += 25
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')

View file

@ -31,15 +31,7 @@ export default function (part) {
'stroke-xl', 'stroke-xl',
'stroke-2xl', 'stroke-2xl',
]) ])
store.set('styles', [ store.set('styles', ['default-style', 'dotted', 'dashed', 'lashed', 'sa', 'help', 'hidden'])
'default-style',
'dotted',
'dashed',
'lashed',
'sa',
'help',
'hidden',
])
if (options.only) return part if (options.only) return part

View file

@ -5,11 +5,10 @@ export default function (part, demo=false) {
let y = store.get('y') let y = store.get('y')
const w = store.get('w') const w = store.get('w')
y += 10 y += 10
if (!demo) paths.noClip = new Path() if (!demo)
.move(new Point(0, y)) paths.noClip = new Path().move(new Point(0, y)).line(new Point(10, y)).attr('class', 'hidden')
.line(new Point(10, y)) else
.attr('class', 'hidden') points.macros = new Point(0, y)
else points.macros = new Point(0,y)
.attr('data-text', 'Macros') .attr('data-text', 'Macros')
.attr('data-text-class', 'text-lg bold') .attr('data-text-class', 'text-lg bold')
@ -41,7 +40,7 @@ export default function (part, demo=false) {
from: new Point(0, y), from: new Point(0, y),
to: new Point(w, y), to: new Point(w, y),
grainline: true, grainline: true,
prefix: 'combo' prefix: 'combo',
}) })
// hd, vd, ld, and pd // hd, vd, ld, and pd

View file

@ -11,17 +11,19 @@ export default function (part, demo=false) {
bnotch: 15, bnotch: 15,
button: 15, button: 15,
buttonhole: 25, buttonhole: 25,
"buttonhole-start": 15, 'buttonhole-start': 15,
"buttonhole-end": 25, 'buttonhole-end': 25,
"snap-socket": 25, 'snap-socket': 25,
"snap-stud": 15, 'snap-stud': 15,
} }
y += 20 y += 20
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')
else points.snippets = new Point(0,y) else
points.snippets = new Point(0, y)
.attr('data-text', 'Snippets') .attr('data-text', 'Snippets')
.attr('data-text-class', 'text-lg bold') .attr('data-text-class', 'text-lg bold')
y += 10 y += 10

View file

@ -7,7 +7,8 @@ export default function (part, demo=false) {
// Stroke styles // Stroke styles
y += 25 y += 25
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')

View file

@ -1,13 +1,13 @@
export default function (part, demo = false) { export default function (part, demo = false) {
const { Point, Path, points, paths, store, options } = part.shorthand() const { Point, Path, points, paths, store, options } = part.shorthand()
if (options.only === 'text' || demo) { if (options.only === 'text' || demo) {
let y = store.get('y') let y = store.get('y')
const w = store.get('w') const w = store.get('w')
// Text sizes // Text sizes
y += 15 y += 15
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')
@ -17,7 +17,7 @@ export default function (part, demo=false) {
const sizes = { const sizes = {
'text-xs': 3, 'text-xs': 3,
'text-sm': 5, 'text-sm': 5,
'text': 8, text: 8,
'text-lg': 10, 'text-lg': 10,
'text-xl': 14, 'text-xl': 14,
'text-2xl': 22, 'text-2xl': 22,
@ -63,13 +63,9 @@ export default function (part, demo=false) {
.attr('data-text', 'Text style') .attr('data-text', 'Text style')
.attr('data-text-class', 'text-lg bold') .attr('data-text-class', 'text-lg bold')
y += 10 y += 10
points.titalic = new Point(0, y) points.titalic = new Point(0, y).attr('data-text', '.italic').attr('data-text-class', 'italic')
.attr('data-text', '.italic')
.attr('data-text-class', 'italic')
y += 10 y += 10
points.tbold = new Point(0, y) points.tbold = new Point(0, y).attr('data-text', '.bold').attr('data-text-class', 'bold')
.attr('data-text', '.bold')
.attr('data-text-class', 'bold')
store.set('y', y) store.set('y', y)
} }

View file

@ -7,7 +7,8 @@ export default function (part, demo=false) {
// Stroke widths // Stroke widths
y += 25 y += 25
if (!demo) paths.noClip = new Path() if (!demo)
paths.noClip = new Path()
.move(new Point(0, y - 5)) .move(new Point(0, y - 5))
.line(new Point(10, y - 5)) .line(new Point(10, y - 5))
.attr('class', 'hidden') .attr('class', 'hidden')