@@ -105,6 +105,7 @@ element_props <- list(
105105 linewidth = property_nullable(S7 :: class_numeric ),
106106 linetype = property_nullable(S7 :: class_numeric | S7 :: class_character ),
107107 lineend = property_choice(c(" round" , " butt" , " square" ), allow_null = TRUE ),
108+ linejoin = property_choice(c(" round" , " mitre" , " bevel" ), allow_null = TRUE ),
108109 shape = property_nullable(S7 :: class_numeric | S7 :: class_character ),
109110 arrow = property_nullable(S7 :: new_S3_class(" arrow" ) | S7 :: class_logical ),
110111 arrow.fill = property_nullable(S7 :: class_character | S7 :: class_logical ),
@@ -116,18 +117,20 @@ element_props <- list(
116117# ' @rdname element
117118element_rect <- S7 :: new_class(
118119 " 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" )],
120123 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()){
123126 if (lifecycle :: is_present(size )) {
124127 deprecate_warn0(" 3.4.0" , " element_rect(size)" , " element_rect(linewidth)" )
125128 linewidth <- size
126129 }
127130 S7 :: new_object(
128131 S7 :: S7_object(),
129132 fill = fill , colour = color %|| % colour ,
130- linewidth = linewidth , linetype = linetype ,
133+ linewidth = linewidth , linetype = linetype , linejoin = linejoin ,
131134 inherit.blank = inherit.blank
132135 )
133136 }
@@ -140,12 +143,14 @@ element_rect <- S7::new_class(
140143element_line <- S7 :: new_class(
141144 " element_line" , parent = element ,
142145 properties = element_props [c(
143- " colour" , " linewidth" , " linetype" , " lineend" , " arrow" , " arrow.fill" ,
146+ " colour" , " linewidth" , " linetype" , " lineend" , " linejoin" ,
147+ " arrow" , " arrow.fill" ,
144148 " inherit.blank"
145149 )],
146150 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()) {
149154 if (lifecycle :: is_present(size )) {
150155 deprecate_warn0(" 3.4.0" , " element_line(size)" , " element_line(linewidth)" )
151156 linewidth <- size
@@ -155,6 +160,7 @@ element_line <- S7::new_class(
155160 S7 :: S7_object(),
156161 colour = colour ,
157162 linewidth = linewidth , linetype = linetype , lineend = lineend ,
163+ linejoin = linejoin ,
158164 arrow = arrow %|| % FALSE ,
159165 arrow.fill = arrow.fill %|| % colour ,
160166 inherit.blank = inherit.blank
@@ -212,15 +218,16 @@ element_text <- S7::new_class(
212218element_polygon <- S7 :: new_class(
213219 " element_polygon" , parent = element ,
214220 properties = element_props [c(
215- " fill" , " colour" , " linewidth" , " linetype" , " inherit.blank"
221+ " fill" , " colour" , " linewidth" , " linetype" , " linejoin " , " inherit.blank"
216222 )],
217223 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 ) {
219226 colour <- color %|| % colour
220227 S7 :: new_object(
221228 S7 :: S7_object(),
222229 fill = fill , colour = color %|| % colour , linewidth = linewidth ,
223- linetype = linetype , inherit.blank = inherit.blank
230+ linetype = linetype , linejoin = linejoin , inherit.blank = inherit.blank
224231 )
225232 }
226233)
@@ -412,17 +419,19 @@ S7::method(element_grob, element_blank) <- function(element, ...) zeroGrob()
412419
413420S7 :: method(element_grob , element_rect ) <-
414421 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 ,
416424 ... , size = deprecated()) {
417425
418426 if (lifecycle :: is_present(size )) {
419427 deprecate_warn0(" 3.4.0" , " element_grob.element_rect(size)" , " element_grob.element_rect(linewidth)" )
420428 linewidth <- size
421429 }
422430
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 )
424432 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 )
426435
427436 rectGrob(x , y , width , height , gp = modify_list(element_gp , gp ), ... )
428437 }
@@ -458,7 +467,7 @@ S7::method(element_grob, element_text) <-
458467S7 :: method(element_grob , element_line ) <-
459468 function (element , x = 0 : 1 , y = 0 : 1 ,
460469 colour = NULL , linewidth = NULL , linetype = NULL , lineend = NULL ,
461- arrow.fill = NULL ,
470+ linejoin = NULL , arrow.fill = NULL ,
462471 default.units = " npc" , id.lengths = NULL , ... , size = deprecated()) {
463472
464473 if (lifecycle :: is_present(size )) {
@@ -479,12 +488,12 @@ S7::method(element_grob, element_line) <-
479488 # The gp settings can override element_gp
480489 gp <- gg_par(
481490 col = colour , fill = arrow.fill %|| % colour ,
482- lwd = linewidth , lty = linetype , lineend = lineend
491+ lwd = linewidth , lty = linetype , lineend = lineend , linejoin = linejoin
483492 )
484493 element_gp <- gg_par(
485494 col = element @ colour , fill = element @ arrow.fill %|| % element @ colour ,
486495 lwd = element @ linewidth , lty = element @ linetype ,
487- lineend = element @ lineend
496+ lineend = element @ lineend , linejoin = element @ linejoin
488497 )
489498
490499 polylineGrob(
@@ -498,13 +507,15 @@ S7::method(element_grob, element_polygon) <-
498507 function (element , x = c(0 , 0.5 , 1 , 0.5 ),
499508 y = c(0.5 , 1 , 0.5 , 0 ), fill = NULL ,
500509 colour = NULL , linewidth = NULL ,
501- linetype = NULL , ... ,
510+ linetype = NULL , linejoin = NULL , ... ,
502511 id = NULL , id.lengths = NULL ,
503512 pathId = NULL , pathId.lengths = NULL ) {
504513
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 )
506516 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 )
508519 pathGrob(
509520 x = x , y = y , gp = modify_list(element_gp , gp ), ... ,
510521 # We swap the id logic so that `id` is always the (super)group id
0 commit comments