Skip to content

Commit e0e8bdc

Browse files
committed
prevent margin from changing the unit class when subclassing (#3177)
1 parent 1112f76 commit e0e8bdc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/margins.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#' @rdname element
55
#' @export
66
margin <- function(t = 0, r = 0, b = 0, l = 0, unit = "pt") {
7-
structure(unit(c(t, r, b, l), unit), class = c("margin", "unit"))
7+
u <- unit(c(t, r, b, l), unit)
8+
class(u) <- c("margin", class(u))
9+
u
810
}
911
is.margin <- function(x) {
1012
inherits(x, "margin")

0 commit comments

Comments
 (0)