@@ -1242,21 +1242,31 @@ uniq <- function(x) {
1242
1242
make_strip_rect <- function (xdom , ydom , theme , side = " top" ) {
1243
1243
rekt <- rect2shape(theme [[" strip.background" ]])
1244
1244
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" ))
1246
1249
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" ))
1248
1254
if (" right" %in% side ) {
1249
1255
# x-padding should be accounted for in `layout.margin.r`
1250
- rekt $ x0 <- xdom [2 ]
1251
- rekt $ x1 <- xdom [2 ] + xTextSize
1252
1256
rekt $ y0 <- ydom [1 ]
1253
1257
rekt $ y1 <- ydom [2 ]
1258
+ rekt $ x0 <- 0
1259
+ rekt $ x1 <- rightSize
1260
+ rekt $ xanchor <- xdom [2 ]
1261
+ rekt $ xsizemode <- " pixel"
1254
1262
}
1255
1263
if (" top" %in% side ) {
1256
1264
rekt $ x0 <- xdom [1 ]
1257
1265
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"
1260
1270
}
1261
1271
list (rekt )
1262
1272
}
0 commit comments