Skip to content

Commit 552707f

Browse files
authored
Move build-time calculations to .onLoad() (#3275)
1 parent 7582d60 commit 552707f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

R/grob-null.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#' @export
55
zeroGrob <- function() .zeroGrob
66

7-
.zeroGrob <- grob(cl = "zeroGrob", name = "NULL")
7+
# Will get assigned in .onLoad()
8+
.zeroGrob <- NULL
9+
810
#' @export
911
#' @method widthDetails zeroGrob
1012
widthDetails.zeroGrob <- function(x) unit(0, "cm")

R/theme-current.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' @include theme-defaults.r
22
#' @include theme-elements.r
3-
ggplot_global$theme_current <- theme_gray()
3+
NULL
44

55
#' Get, set, and modify the active theme
66
#'

R/zzz.r

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
.onLoad <- function(...) {
2020
backport_unit_methods()
2121

22+
.zeroGrob <<- grob(cl = "zeroGrob", name = "NULL")
23+
24+
ggplot_global$theme_current <- theme_gray()
25+
2226
# To avoid namespace clash with dplyr.
2327
# It seems surprising that this hack works
2428
if (requireNamespace("dplyr", quietly = TRUE)) {

0 commit comments

Comments
 (0)