@@ -13,6 +13,8 @@ export class Text extends Mark {
13
13
title,
14
14
fill,
15
15
fillOpacity,
16
+ stroke,
17
+ strokeOpacity,
16
18
textAnchor,
17
19
fontFamily,
18
20
fontSize,
@@ -25,6 +27,8 @@ export class Text extends Mark {
25
27
...options
26
28
} = { }
27
29
) {
30
+ const [ vstroke , cstroke ] = maybeColor ( stroke , "none" ) ;
31
+ const [ vstrokeOpacity , cstrokeOpacity ] = maybeNumber ( strokeOpacity ) ;
28
32
const [ vfill , cfill ] = maybeColor ( fill , "currentColor" ) ;
29
33
const [ vfillOpacity , cfillOpacity ] = maybeNumber ( fillOpacity ) ;
30
34
const [ vrotate , crotate ] = maybeNumber ( rotate , 0 ) ;
@@ -39,11 +43,19 @@ export class Text extends Mark {
39
43
{ name : "text" , value : text } ,
40
44
{ name : "title" , value : title , optional : true } ,
41
45
{ name : "fill" , value : vfill , scale : "color" , optional : true } ,
42
- { name : "fillOpacity" , value : vfillOpacity , scale : "opacity" , optional : true }
46
+ { name : "fillOpacity" , value : vfillOpacity , scale : "opacity" , optional : true } ,
47
+ { name : "stroke" , value : vstroke , scale : "color" , optional : true } ,
48
+ { name : "strokeOpacity" , value : vstrokeOpacity , scale : "opacity" , optional : true }
43
49
] ,
44
50
options
45
51
) ;
46
- Style ( this , { fill : cfill , fillOpacity : cfillOpacity , ...options } ) ;
52
+ Style ( this , {
53
+ fill : cfill ,
54
+ fillOpacity : cfillOpacity ,
55
+ stroke : cstroke ,
56
+ strokeOpacity : cstrokeOpacity ,
57
+ ...options
58
+ } ) ;
47
59
this . rotate = crotate ;
48
60
this . textAnchor = string ( textAnchor ) ;
49
61
this . fontFamily = string ( fontFamily ) ;
@@ -57,7 +69,7 @@ export class Text extends Mark {
57
69
render (
58
70
I ,
59
71
{ x, y} ,
60
- { x : X , y : Y , rotate : R , text : T , title : L , fill : F , fillOpacity : FO , fontSize : FS } ,
72
+ { x : X , y : Y , rotate : R , text : T , title : L , fill : F , fillOpacity : FO , fontSize : FS , stroke : S , strokeOpacity : SO } ,
61
73
{ width, height, marginTop, marginRight, marginBottom, marginLeft}
62
74
) {
63
75
const { rotate} = this ;
@@ -83,6 +95,8 @@ export class Text extends Mark {
83
95
. call ( applyAttr , "fill" , F && ( i => F [ i ] ) )
84
96
. call ( applyAttr , "fill-opacity" , FO && ( i => FO [ i ] ) )
85
97
. call ( applyAttr , "font-size" , FS && ( i => FS [ i ] ) )
98
+ . call ( applyAttr , "stroke" , S && ( i => S [ i ] ) )
99
+ . call ( applyAttr , "stroke-opacity" , SO && ( i => SO [ i ] ) )
86
100
. text ( i => T [ i ] )
87
101
. call ( title ( L ) ) )
88
102
. node ( ) ;
0 commit comments