R/boxGrobs_coords.R

Defines functions coords

Documented in coords

#' Get the box coordinates
#'
#' Retrieves the boxes \code{"coords"} attribute.
#'
#' @param box The \code{\link{boxGrob}} or \code{\link{boxPropGrob}}
#' @return A list with the coordinates
#'
#' @importFrom checkmate assert_class
#' @family flowchart components
#' @export
#' @examples
#' box <- boxGrob("A test box")
#' coords(box)
coords <- function(box) {
  # Check if not already a coordinate element
  if (inherits(box, "coords")) {
    return(box)
  }

  assert_class(box, "box")
  attr(box, "coords")
}

Try the Gmisc package in your browser

Any scripts or data that you put into this service are public.

Gmisc documentation built on Aug. 26, 2023, 1:07 a.m.