swh:1:snp:3a4bc456f1832b81cfa640941c632f6d5535d3a4
Raw File
Tip revision: cd86b08de1e3b03a04b7def69418a9e9a1b5a441 authored by R. Wayne Oldford on 16 March 2021, 21:40:03 UTC
version 1.3.4
Tip revision: cd86b08
loonGrob_l_navigator.R

#' @rdname loonGrob
#'
#' @export

loonGrob.l_navigator <- function(target, name = NULL, gp = NULL, vp = NULL){
    # Probably never used
    widget <- target
    color <- as_hex6color(widget['color'])
    label <- widget['label']

    vp <- vpStack(
        plotViewport(margins = c(4.1, 5.1, 2.1, 2.1), name = "plotViewport"),
        dataViewport(xscale = c(0,1), yscale = c(0,1), name = "dataViewport")
    )

    gList(
        pointsGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                   gp = gpar(fill = color, cex = 3.5),
                   pch = 21, vp = vp,
                   name = "navigator"
        ),
        condGrob(
            test = length(label) != 0,
            grobFun = textGrob,
            name = "navigator label",
            x = unit(0.5, "npc"),
            y = unit(0.5, "npc"),
            label = paste(label, collapse = " "),
            gp = gpar(fill = l_getOption("foreground"), fontsize = 9),
            vp = vp
        )
    )
}
back to top