@@ -105,6 +105,7 @@ element_props <- list(
105
105
linewidth = property_nullable(S7 :: class_numeric ),
106
106
linetype = property_nullable(S7 :: class_numeric | S7 :: class_character ),
107
107
lineend = property_choice(c(" round" , " butt" , " square" ), allow_null = TRUE ),
108
+ linejoin = property_choice(c(" round" , " mitre" , " bevel" ), allow_null = TRUE ),
108
109
shape = property_nullable(S7 :: class_numeric | S7 :: class_character ),
109
110
arrow = property_nullable(S7 :: new_S3_class(" arrow" ) | S7 :: class_logical ),
110
111
arrow.fill = property_nullable(S7 :: class_character | S7 :: class_logical ),
@@ -116,18 +117,20 @@ element_props <- list(
116
117
# ' @rdname element
117
118
element_rect <- S7 :: new_class(
118
119
" element_rect" , parent = element ,
119
- properties = element_props [c(" fill" , " colour" , " linewidth" , " linetype" , " inherit.blank" )],
120
+ properties = element_props [c(" fill" , " colour" ,
121
+ " linewidth" , " linetype" , " linejoin" ,
122
+ " inherit.blank" )],
120
123
constructor = function (fill = NULL , colour = NULL , linewidth = NULL ,
121
- linetype = NULL , color = NULL , inherit.blank = FALSE ,
122
- size = deprecated()){
124
+ linetype = NULL , color = NULL , linejoin = NULL ,
125
+ inherit.blank = FALSE , size = deprecated()){
123
126
if (lifecycle :: is_present(size )) {
124
127
deprecate_warn0(" 3.4.0" , " element_rect(size)" , " element_rect(linewidth)" )
125
128
linewidth <- size
126
129
}
127
130
S7 :: new_object(
128
131
S7 :: S7_object(),
129
132
fill = fill , colour = color %|| % colour ,
130
- linewidth = linewidth , linetype = linetype ,
133
+ linewidth = linewidth , linetype = linetype , linejoin = linejoin ,
131
134
inherit.blank = inherit.blank
132
135
)
133
136
}
@@ -140,12 +143,14 @@ element_rect <- S7::new_class(
140
143
element_line <- S7 :: new_class(
141
144
" element_line" , parent = element ,
142
145
properties = element_props [c(
143
- " colour" , " linewidth" , " linetype" , " lineend" , " arrow" , " arrow.fill" ,
146
+ " colour" , " linewidth" , " linetype" , " lineend" , " linejoin" ,
147
+ " arrow" , " arrow.fill" ,
144
148
" inherit.blank"
145
149
)],
146
150
constructor = function (colour = NULL , linewidth = NULL , linetype = NULL ,
147
- lineend = NULL , color = NULL , arrow = NULL ,
148
- arrow.fill = NULL , inherit.blank = FALSE , size = deprecated()) {
151
+ lineend = NULL , color = NULL , linejoin = NULL ,
152
+ arrow = NULL , arrow.fill = NULL ,
153
+ inherit.blank = FALSE , size = deprecated()) {
149
154
if (lifecycle :: is_present(size )) {
150
155
deprecate_warn0(" 3.4.0" , " element_line(size)" , " element_line(linewidth)" )
151
156
linewidth <- size
@@ -155,6 +160,7 @@ element_line <- S7::new_class(
155
160
S7 :: S7_object(),
156
161
colour = colour ,
157
162
linewidth = linewidth , linetype = linetype , lineend = lineend ,
163
+ linejoin = linejoin ,
158
164
arrow = arrow %|| % FALSE ,
159
165
arrow.fill = arrow.fill %|| % colour ,
160
166
inherit.blank = inherit.blank
@@ -212,15 +218,16 @@ element_text <- S7::new_class(
212
218
element_polygon <- S7 :: new_class(
213
219
" element_polygon" , parent = element ,
214
220
properties = element_props [c(
215
- " fill" , " colour" , " linewidth" , " linetype" , " inherit.blank"
221
+ " fill" , " colour" , " linewidth" , " linetype" , " linejoin " , " inherit.blank"
216
222
)],
217
223
constructor = function (fill = NULL , colour = NULL , linewidth = NULL ,
218
- linetype = NULL , color = NULL , inherit.blank = FALSE ) {
224
+ linetype = NULL , color = NULL , linejoin = NULL ,
225
+ inherit.blank = FALSE ) {
219
226
colour <- color %|| % colour
220
227
S7 :: new_object(
221
228
S7 :: S7_object(),
222
229
fill = fill , colour = color %|| % colour , linewidth = linewidth ,
223
- linetype = linetype , inherit.blank = inherit.blank
230
+ linetype = linetype , linejoin = linejoin , inherit.blank = inherit.blank
224
231
)
225
232
}
226
233
)
@@ -412,17 +419,19 @@ S7::method(element_grob, element_blank) <- function(element, ...) zeroGrob()
412
419
413
420
S7 :: method(element_grob , element_rect ) <-
414
421
function (element , x = 0.5 , y = 0.5 , width = 1 , height = 1 ,
415
- fill = NULL , colour = NULL , linewidth = NULL , linetype = NULL ,
422
+ fill = NULL , colour = NULL ,
423
+ linewidth = NULL , linetype = NULL , linejoin = NULL ,
416
424
... , size = deprecated()) {
417
425
418
426
if (lifecycle :: is_present(size )) {
419
427
deprecate_warn0(" 3.4.0" , " element_grob.element_rect(size)" , " element_grob.element_rect(linewidth)" )
420
428
linewidth <- size
421
429
}
422
430
423
- gp <- gg_par(lwd = linewidth , col = colour , fill = fill , lty = linetype )
431
+ gp <- gg_par(lwd = linewidth , col = colour , fill = fill , lty = linetype , linejoin = linejoin )
424
432
element_gp <- gg_par(lwd = element @ linewidth , col = element @ colour ,
425
- fill = element @ fill , lty = element @ linetype )
433
+ fill = element @ fill , lty = element @ linetype ,
434
+ linejoin = element @ linejoin )
426
435
427
436
rectGrob(x , y , width , height , gp = modify_list(element_gp , gp ), ... )
428
437
}
@@ -458,7 +467,7 @@ S7::method(element_grob, element_text) <-
458
467
S7 :: method(element_grob , element_line ) <-
459
468
function (element , x = 0 : 1 , y = 0 : 1 ,
460
469
colour = NULL , linewidth = NULL , linetype = NULL , lineend = NULL ,
461
- arrow.fill = NULL ,
470
+ linejoin = NULL , arrow.fill = NULL ,
462
471
default.units = " npc" , id.lengths = NULL , ... , size = deprecated()) {
463
472
464
473
if (lifecycle :: is_present(size )) {
@@ -479,12 +488,12 @@ S7::method(element_grob, element_line) <-
479
488
# The gp settings can override element_gp
480
489
gp <- gg_par(
481
490
col = colour , fill = arrow.fill %|| % colour ,
482
- lwd = linewidth , lty = linetype , lineend = lineend
491
+ lwd = linewidth , lty = linetype , lineend = lineend , linejoin = linejoin
483
492
)
484
493
element_gp <- gg_par(
485
494
col = element @ colour , fill = element @ arrow.fill %|| % element @ colour ,
486
495
lwd = element @ linewidth , lty = element @ linetype ,
487
- lineend = element @ lineend
496
+ lineend = element @ lineend , linejoin = element @ linejoin
488
497
)
489
498
490
499
polylineGrob(
@@ -498,13 +507,15 @@ S7::method(element_grob, element_polygon) <-
498
507
function (element , x = c(0 , 0.5 , 1 , 0.5 ),
499
508
y = c(0.5 , 1 , 0.5 , 0 ), fill = NULL ,
500
509
colour = NULL , linewidth = NULL ,
501
- linetype = NULL , ... ,
510
+ linetype = NULL , linejoin = NULL , ... ,
502
511
id = NULL , id.lengths = NULL ,
503
512
pathId = NULL , pathId.lengths = NULL ) {
504
513
505
- gp <- gg_par(lwd = linewidth , col = colour , fill = fill , lty = linetype )
514
+ gp <- gg_par(lwd = linewidth , col = colour , fill = fill ,
515
+ lty = linetype , linejoin = linejoin )
506
516
element_gp <- gg_par(lwd = element @ linewidth , col = element @ colour ,
507
- fill = element @ fill , lty = element @ linetype )
517
+ fill = element @ fill , lty = element @ linetype ,
518
+ linejoin = element @ linejoin )
508
519
pathGrob(
509
520
x = x , y = y , gp = modify_list(element_gp , gp ), ... ,
510
521
# We swap the id logic so that `id` is always the (super)group id
0 commit comments