Skip to content

Commit

Permalink
Merge pull request #14 from miyamot0/beezhooks
Browse files Browse the repository at this point in the history
Fix for label omissions when vector of tags alone
  • Loading branch information
miyamot0 authored Nov 19, 2021
2 parents f9dbb55 + a5b406d commit 0735c96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
12 changes: 3 additions & 9 deletions R/drawing.R
Original file line number Diff line number Diff line change
Expand Up @@ -437,24 +437,18 @@ draw_label_phase <- function(coreFrame, currentLayer, facetName) {

currentLabel = currentLayer$labels[[lindex]]

print(currentLabel)
label = ifelse(is.null(label),
currentLabel,
label)

tempX = ifelse("x" %in% names(currentLabel),
currentLabel[[ "x" ]],
currentLayer$x)

# tempX = ifelse(!is.null(currentLabel[[ "x" ]]),
# currentLabel[[ "x" ]],
# currentLayer$x)

tempY = ifelse("y" %in% names(currentLabel),
currentLabel[[ "y" ]],
currentLayer$y)

# tempY = ifelse(!is.null(currentLabel[[ "y" ]]),
# currentLabel[[ "y" ]],
# currentLayer$y)

srt = ifelse("srt" %in% names(currentLabel),
currentLabel[["srt"]],
0)
Expand Down
31 changes: 18 additions & 13 deletions R/scr_fxl.R
Original file line number Diff line number Diff line change
Expand Up @@ -1013,34 +1013,39 @@ print.fxl <- function(coreFrame, ...) {

for (pname in plines) {

# start of index for named list
if (!(pname %in% names(indexNum))) indexNum[[pname]] <- 1

tmpX1 = currentLayer$lines[[pname]][[facetIndex]][["x1"]]
tmpX2 = ifelse(is.null(currentLayer$lines[[pname]][[facetIndex]][["x2"]]),
currentIndex = which(names(currentLayer$lines[[pname]]) == currentFacet)

if (length(currentIndex) == 0) next

tmpX1 = currentLayer$lines[[pname]][[currentIndex]][["x1"]]
tmpX2 = ifelse(is.null(currentLayer$lines[[pname]][[currentIndex]][["x2"]]),
tmpX1,
currentLayer$lines[[pname]][[facetIndex]][["x2"]])
currentLayer$lines[[pname]][[currentIndex]][["x2"]])

tmpY1 = ifelse(is.null(currentLayer$lines[[pname]][[facetIndex]][["y1"]]),
tmpY1 = ifelse(is.null(currentLayer$lines[[pname]][[currentIndex]][["y1"]]),
0,
currentLayer$lines[[pname]][[facetIndex]][["y1"]])
tmpY2 = ifelse(is.null(currentLayer$lines[[pname]][[facetIndex]][["y2"]]),
currentLayer$lines[[pname]][[currentIndex]][["y1"]])
tmpY2 = ifelse(is.null(currentLayer$lines[[pname]][[currentIndex]][["y2"]]),
0,
currentLayer$lines[[pname]][[facetIndex]][["y2"]])
currentLayer$lines[[pname]][[currentIndex]][["y2"]])

currentLayer$lines[[pname]][[facetIndex]][["topDraw"]] <- cnvrt.coords(
currentLayer$lines[[pname]][[currentIndex]][["topDraw"]] <- cnvrt.coords(
tmpX1,
coreFrame$dims[["max.local.y"]])

currentLayer$lines[[pname]][[facetIndex]][["botDraw"]] <- cnvrt.coords(
currentLayer$lines[[pname]][[currentIndex]][["botDraw"]] <- cnvrt.coords(
tmpX2,
-((coreFrame$dims[["max.local.y"]] - coreFrame$dims[["min.local.y"]]) * 0.04))

tmp.point.top.dev <- cnvrt.coords(
currentLayer$lines[[pname]][[facetIndex]][["topDraw"]]$dev,
currentLayer$lines[[pname]][[currentIndex]][["topDraw"]]$dev,
input = 'dev')

tmp.point.bot.dev <- cnvrt.coords(
currentLayer$lines[[pname]][[facetIndex]][["botDraw"]]$dev,
currentLayer$lines[[pname]][[currentIndex]][["botDraw"]]$dev,
input = 'dev')

segments(tmp.point.top.dev$usr$x,
Expand All @@ -1049,11 +1054,11 @@ print.fxl <- function(coreFrame, ...) {
tmp.point.bot.dev$usr$y,
col = 'black')

currentLayer$lines[[pname]][[facetIndex]][["topDraw"]] <- cnvrt.coords(
currentLayer$lines[[pname]][[currentIndex]][["topDraw"]] <- cnvrt.coords(
tmpX1,
tmpY2)$dev

currentLayer$lines[[pname]][[facetIndex]][["botDraw"]] <- cnvrt.coords(
currentLayer$lines[[pname]][[currentIndex]][["botDraw"]] <- cnvrt.coords(
tmpX2,
tmpY2)$dev

Expand Down

0 comments on commit 0735c96

Please sign in to comment.