R/l_isLoon.R

Defines functions l_isLoon.l_tour_compound l_isLoon.l_tour l_isLoon.loon l_isLoon.default l_isLoon

l_isLoon <- function(target) {
  UseMethod("l_isLoon", target)
}

l_isLoon.default <- function(target) {
  FALSE
}

l_isLoon.loon <- function(target) {
  if(is.list(target)) {
    FALSE
  } else {
    as.logical(as.character(tcltk::tcl('::loon::isKnownWidget', target)))
  }
}

l_isLoon.l_tour <- function(target) {
  plot_name <- setdiff(names(unclass(target)), "projection")
  plot <- target[[plot_name]]
  l_isLoon(plot)
}

l_isLoon.l_tour_compound <- function(target) {
  plot_name <- setdiff(names(unclass(target)), "projection")
  plot <- target[[plot_name]]
  all(vapply(plot,
             function(p) l_isLoon(p),
             logical(1L)))
}
z267xu/loon.summary documentation built on March 15, 2021, 2:15 p.m.