@@ -821,10 +821,7 @@ calc_element <- function(element, theme, verbose = FALSE, skip_blank = FALSE,
821821 # recursion; we initiate skipping blanks if we encounter an element that
822822 # doesn't inherit blank.
823823 skip_blank <- skip_blank ||
824- (! is.null(el_out ) &&
825- ! isTRUE(S7 :: S7_inherits(el_out ) &&
826- S7 :: prop_exists(el_out , " inherit.blank" ) &&
827- el_out @ inherit.blank ))
824+ (! is.null(el_out ) && ! isTRUE(try_prop(el_out , " inherit.blank" )))
828825
829826 parents <- lapply(
830827 pnames ,
@@ -964,8 +961,8 @@ combine_elements <- function(e1, e2) {
964961
965962 # If e2 is element_blank, and e1 inherits blank inherit everything from e2,
966963 # otherwise ignore e2
967- if (S7 :: S7_inherits (e2 , element_blank )) {
968- if (S7 :: prop_exists( e1 , " inherit.blank" ) && e1 @ inherit.blank ) {
964+ if (is_theme_element (e2 , " blank " )) {
965+ if (isTRUE(try_prop( e1 , " inherit.blank" )) ) {
969966 return (e2 )
970967 } else {
971968 return (e1 )
@@ -977,12 +974,12 @@ combine_elements <- function(e1, e2) {
977974 S7 :: props(e1 )[n ] <- S7 :: props(e2 )[n ]
978975
979976 # Calculate relative sizes
980- if (S7 :: prop_exists( e1 , " size" ) && is.rel( e1 @ size )) {
977+ if (is.rel(try_prop( e1 , " size" ))) {
981978 e1 @ size <- e2 @ size * unclass(e1 @ size )
982979 }
983980
984981 # Calculate relative linewidth
985- if (S7 :: prop_exists( e1 , " linewidth" ) && is.rel( e1 @ linewidth )) {
982+ if (is.rel(try_prop( e1 , " linewidth" ))) {
986983 e1 @ linewidth <- e2 @ linewidth * unclass(e1 @ linewidth )
987984 }
988985
0 commit comments