Skip to content

Commit 23f8c6a

Browse files
committed
modifier: Rename decoration to modifier
1 parent 881f3fe commit 23f8c6a

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

src/canvas.typ

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@
6262
nodes: (:),
6363
// Group stack
6464
groups: (),
65-
// Registeretd decoration functions
66-
decorations: (
67-
wave: wave,
68-
zigzag: zigzag,
69-
coil: coil,
70-
),
65+
// Registeretd modifier functions
7166
path-modifiers: (
7267
linearize: modifiers.linearize,
7368
wave: modifiers.wave,
69+
//zigzag: modifiers.zigzag,
70+
//coil: modifiers.coil,
71+
ticks: modifiers.ticks,
7472
),
7573
)
7674

src/draw/grouping.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@
583583
let (ctx, drawables, ..) = process.many(ctx, util.resolve-body(ctx, body))
584584

585585
let style = styles.resolve(ctx.style, merge: style.named())
586-
style.decoration = modifier
586+
style.modifier = modifier
587587

588588
drawables = apply-path-modifier(ctx, style, drawables, close)
589589

src/draw/shapes.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
// Apply path decoration to drawables
4242
#let _apply-decoration(ctx, style, drawables, close) = {
43-
return modifier.apply-path-modifier(ctx, style, drawables, close).first()
43+
return modifier.apply-path-modifier(ctx, style, drawables, close)
4444
}
4545

4646
/// Draws a circle or ellipse.

src/modifier.typ

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@
6666
drawables = (drawables,)
6767
}
6868

69-
let fns = if type(style.decoration) == array {
70-
style.decoration
69+
let fns = if type(style.modifier) == array {
70+
style.modifier
7171
} else {
72-
(style.decoration,)
72+
(style.modifier,)
7373
}.map(n => {
7474
let name = if type(n) == dictionary {
7575
n.name
@@ -94,8 +94,8 @@
9494
(fn: fn, style: style + extra-style)
9595
})
9696

97-
// Unset decorations to prevent unwanted recursion
98-
style.decoration = ()
97+
// Unset modifiers to prevent unwanted recursion
98+
style.modifier = ()
9999

100100
// Apply function on all drawables
101101
return drawables.map(d => {

src/styles.typ

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
// - "CURVED" Preserving the bezier curve by calculating new control points
1010
shorten: "LINEAR",
1111

12-
// Path decorations:
13-
// - Named decoration: "wave",
14-
// - Decoration function taking a path
15-
decoration: none,
12+
// Path modifier:
13+
// - Named modifier: "wave",
14+
// - Modifier function taking a path
1615
modifier: (:),
1716

1817
// Allowed values:
@@ -66,7 +65,7 @@
6665
radius: auto,
6766
stroke: auto,
6867
fill: auto,
69-
decoration: auto,
68+
modifier: auto,
7069
),
7170
group: (
7271
padding: auto,
@@ -77,22 +76,22 @@
7776
mark: auto,
7877
fill: auto,
7978
stroke: auto,
80-
decoration: auto,
79+
modifier: auto,
8180
),
8281
bezier: (
8382
stroke: auto,
8483
fill: auto,
8584
mark: auto,
8685
shorten: auto,
87-
decoration: auto,
86+
modifier: auto,
8887
),
8988
catmull: (
9089
tension: .5,
9190
mark: auto,
9291
shorten: auto,
9392
stroke: auto,
9493
fill: auto,
95-
decoration: auto,
94+
modifier: auto,
9695
),
9796
hobby: (
9897
/// Curve start and end omega (curlyness)
@@ -101,7 +100,7 @@
101100
shorten: auto,
102101
stroke: auto,
103102
fill: auto,
104-
decoration: auto,
103+
modifier: auto,
105104
),
106105
rect: (
107106
/// Rect corner radius that supports the following types:
@@ -117,7 +116,7 @@
117116
radius: 0,
118117
stroke: auto,
119118
fill: auto,
120-
decoration: auto,
119+
modifier: auto,
121120
),
122121
arc: (
123122
// Supported values:
@@ -130,7 +129,7 @@
130129
stroke: auto,
131130
fill: auto,
132131
radius: auto,
133-
decoration: auto,
132+
modifier: auto,
134133
),
135134
content: (
136135
padding: auto,
@@ -141,7 +140,7 @@
141140
frame: none,
142141
fill: auto,
143142
stroke: auto,
144-
decoration: auto,
143+
modifier: auto,
145144
),
146145
)
147146

0 commit comments

Comments
 (0)