Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
=======================================
Coverage 99.57% 99.58%
=======================================
Files 9 9
Lines 936 954 +18
=======================================
+ Hits 932 950 +18
Misses 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| #' @param vjust numeric, the layout's object vjust. | ||
| #' @return a single logical. | ||
| #' @keywords internal | ||
| use_grob_height_for_object <- function(grob, vjust) { |
There was a problem hiding this comment.
I don't think this needs to be a function as it's only 1 line and is used in one place, we could just have
use_grob_height_for_object <- vjust != 0.5 && !is_flexible_grob(grob) on line 124 above the natural_height assignment
|
Examples: |
|
Example 21 looks bad, the question is if it is expected. It is easy to adjust it by the end user. But it is a problem only for complex_layout as it uses 0 lines in header. |
| " Vjust: %s%s\n", | ||
| object@object@vjust, | ||
| if (object@object@vjust == 0.5) { | ||
| " (default; the object fills the full row regardless of grob type)" |
There was a problem hiding this comment.
i do not think so it is a good description
There was a problem hiding this comment.
We already documented it well so I think we can remove this additional text.
| if (object@object@vjust == 0.5) { | ||
| " (default; the object fills the full row regardless of grob type)" | ||
| } else { | ||
| " (anchors fixed-size grobs; flexible grobs e.g. ggplot still fill the row)" |
There was a problem hiding this comment.
i do not think so it is a good description
There was a problem hiding this comment.
We already documented it well so I think we can remove this additional text.
| #' layout-driven height in npc, then floors the result via `grid::unit.pmax()` | ||
| #' so the viewport never collapses to zero. | ||
| #' | ||
| #' `use_grob_height_for_object evaluates` to `TRUE` when the caller has opted |
There was a problem hiding this comment.
| #' `use_grob_height_for_object evaluates` to `TRUE` when the caller has opted | |
| #' `use_grob_height_for_object` evaluates to `TRUE` when the caller has opted |
Adds a vjust slot to gridifyObject() so users can vertically anchor the rendered object inside its layout row (e.g. vjust = 1 pins a gt/flextable to the top of a taller row instead of stretching it).
New vjust argument on gridifyObject() (default 0.5; fully backwards-compatible).
print() now sizes the object's viewport to grobHeight() for fixed-size grobs when vjust != 0.5, floored at 1 inch via grid::unit.pmax(). Flexible grobs (ggplotGrob-style gtables with null heights, recorded gTrees with childrenvp) keep the historical "fill the row" behaviour.
Detection & expression building factored into is_flexible_grob() and object_viewport_height_expr() in gridify-utils.R, with unit tests.
S4 validity rejects NA, NaN, ±Inf, non-scalar and out-of-range values.
Roxygen on vjust / object_vjust (in simple_layout(), complex_layout(), pharma_layout_*) makes the flexible-grob caveat explicit; show_spec() annotates the Vjust line accordingly.
No changes for users who don't set vjust.