Skip to content

Commit 22fc480

Browse files
committed
apply tidy styling to combine_elements()
1 parent 8fc5ed9 commit 22fc480

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

R/theme.r

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,21 +622,28 @@ merge_element.element <- function(new, old) {
622622
combine_elements <- function(e1, e2) {
623623

624624
# If e2 is NULL, nothing to inherit
625-
if (is.null(e2) || inherits(e1, "element_blank")) return(e1)
625+
if (is.null(e2) || inherits(e1, "element_blank")) {
626+
return(e1)
627+
}
626628

627629
# If e1 is NULL inherit everything from e2
628-
if (is.null(e1)) return(e2)
630+
if (is.null(e1)) {
631+
return(e2)
632+
}
629633

630634
# If neither of e1 or e2 are element_* objects, return e1
631-
if (!inherits(e1, "element") && !inherits(e2, "element")) return(e1)
635+
if (!inherits(e1, "element") && !inherits(e2, "element")) {
636+
return(e1)
637+
}
632638

633639
# If e2 is element_blank, and e1 inherits blank inherit everything from e2,
634640
# otherwise ignore e2
635641
if (inherits(e2, "element_blank")) {
636-
if (e1$inherit.blank)
642+
if (e1$inherit.blank) {
637643
return(e2)
638-
else
644+
} else {
639645
return(e1)
646+
}
640647
}
641648

642649
# If e1 has any NULL properties, inherit them from e2

0 commit comments

Comments
 (0)