Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR aim to fix #6390.

Briefly, instead of implementing a full <zeroGrob> class, we piggyback on the grid::nullGrob().
Simplification is the goal of this PR.

zeroGrob <- function() .zeroGrob

.zeroGrob <- NULL
on_load(.zeroGrob <- add_class(nullGrob(), "zeroGrob"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zeroGrob class is appended here, because inherits(x, "zeroGrob") is sometimes used instead of is.zero(). I expect the situation to be the same in extension packages.

#'
#' @keywords internal
#' @export
zeroGrob <- function() .zeroGrob
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not removed this function altogether because there is some optimisation value in only constructing the .zeroGrob object once per session instead of all over the place. Moreover, I expect it might be prevalent in extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace zeroGrob() with grid::nullGrob()
1 participant