@@ -1242,21 +1242,31 @@ uniq <- function(x) {
12421242make_strip_rect <- function (xdom , ydom , theme , side = " top" ) {
12431243 rekt <- rect2shape(theme [[" strip.background" ]])
12441244 stripTextX <- theme [[" strip.text.x" ]] %|| % theme [[" strip.text" ]]
1245- xTextSize <- unitConvert(stripTextX $ size , " npc" , " width" )
1245+ topSize <-
1246+ mm2pixels(grid :: convertHeight(stripTextX $ margin [1 ], " mm" )) +
1247+ mm2pixels(grid :: convertHeight(stripTextX $ margin [3 ], " mm" )) +
1248+ mm2pixels(grid :: convertHeight(grid :: unit(stripTextX $ size , units = " points" ), " mm" ))
12461249 stripTextY <- theme [[" strip.text.y" ]] %|| % theme [[" strip.text" ]]
1247- yTextSize <- unitConvert(stripTextY $ size , " npc" , " height" )
1250+ rightSize <-
1251+ mm2pixels(grid :: convertWidth(stripTextX $ margin [2 ], " mm" )) +
1252+ mm2pixels(grid :: convertWidth(stripTextX $ margin [4 ], " mm" )) +
1253+ mm2pixels(grid :: convertWidth(grid :: unit(stripTextY $ size , units = " points" ), " mm" ))
12481254 if (" right" %in% side ) {
12491255 # x-padding should be accounted for in `layout.margin.r`
1250- rekt $ x0 <- xdom [2 ]
1251- rekt $ x1 <- xdom [2 ] + xTextSize
12521256 rekt $ y0 <- ydom [1 ]
12531257 rekt $ y1 <- ydom [2 ]
1258+ rekt $ x0 <- 0
1259+ rekt $ x1 <- rightSize
1260+ rekt $ xanchor <- xdom [2 ]
1261+ rekt $ xsizemode <- " pixel"
12541262 }
12551263 if (" top" %in% side ) {
12561264 rekt $ x0 <- xdom [1 ]
12571265 rekt $ x1 <- xdom [2 ]
1258- rekt $ y0 <- ydom [2 ]
1259- rekt $ y1 <- ydom [2 ] + yTextSize
1266+ rekt $ y0 <- 0
1267+ rekt $ y1 <- topSize
1268+ rekt $ yanchor <- ydom [2 ]
1269+ rekt $ ysizemode <- " pixel"
12601270 }
12611271 list (rekt )
12621272}
0 commit comments