Skip to content

Commit 884b0b0

Browse files
committed
include new elements in is_theme_element(type)
1 parent 587b87c commit 884b0b0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

R/theme-elements.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,14 @@ element_geom <- function(
251251
is_theme_element <- function(x, type = "any") {
252252
switch(
253253
type %||% "any",
254-
any = inherits(x, "element"),
255-
rect = inherits(x, "element_rect"),
256-
line = inherits(x, "element_line"),
257-
text = inherits(x, "element_text"),
258-
blank = inherits(x, "element_blank"),
254+
any = inherits(x, "element"),
255+
rect = inherits(x, "element_rect"),
256+
line = inherits(x, "element_line"),
257+
text = inherits(x, "element_text"),
258+
blank = inherits(x, "element_blank"),
259+
polygon = inherits(x, "element_polygon"),
260+
point = inherits(x, "element_point"),
261+
geom = inherits(x, "element_geom"),
259262
FALSE
260263
)
261264
}

R/theme.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ calc_element <- function(element, theme, verbose = FALSE, skip_blank = FALSE,
772772
# if we have null properties, try to fill in from ggplot_global$theme_default
773773
el_out <- combine_elements(el_out, ggplot_global$theme_default[[element]])
774774
nullprops <- vapply(el_out, is.null, logical(1))
775-
if (inherits(el_out, "element_geom")) {
775+
if (is_theme_element(el_out, "geom")) {
776776
# Geom elements are expected to have NULL fill/colour, so allow these
777777
# to be missing
778778
nullprops[c("colour", "fill")] <- FALSE

0 commit comments

Comments
 (0)