@@ -1199,44 +1199,36 @@ function createHoverText(hoverData, opts, gd) {
1199
1199
var lx , ly ; // top and left positions of the hover box
1200
1200
1201
1201
// horizontal alignment to end up on screen
1202
- if ( outerWidth > 0 ) {
1203
- if ( lxRight + tWidth < outerWidth && lxRight >= 0 ) {
1204
- lx = lxRight ;
1205
- } else if ( lxLeft + tWidth < outerWidth && lxLeft >= 0 ) {
1206
- lx = lxLeft ;
1207
- } else if ( outerWidth > 0 && xOffset + tWidth < outerWidth ) {
1208
- lx = xOffset ; // subplot left corner
1202
+ if ( lxRight + tWidth < outerWidth && lxRight >= 0 ) {
1203
+ lx = lxRight ;
1204
+ } else if ( lxLeft + tWidth < outerWidth && lxLeft >= 0 ) {
1205
+ lx = lxLeft ;
1206
+ } else if ( xOffset + tWidth < outerWidth ) {
1207
+ lx = xOffset ; // subplot left corner
1208
+ } else {
1209
+ // closest left or right side of the paper
1210
+ if ( lxRight - avgX < avgX - lxLeft + tWidth ) {
1211
+ lx = outerWidth - tWidth ;
1209
1212
} else {
1210
- // closest left or right side of the paper
1211
- if ( lxRight - avgX < avgX - lxLeft + tWidth ) {
1212
- lx = outerWidth - tWidth ;
1213
- } else {
1214
- lx = 0 ;
1215
- }
1213
+ lx = 0 ;
1216
1214
}
1217
- } else {
1218
- lx = lxLeft ;
1219
1215
}
1220
1216
lx += HOVERTEXTPAD ;
1221
1217
1222
1218
// vertical alignement to end up on screen
1223
- if ( outerHeight > 0 ) {
1224
- if ( lyBottom + tHeight < outerHeight && lyBottom >= 0 ) {
1225
- ly = lyBottom ;
1226
- } else if ( lyTop + tHeight < outerHeight && lyTop >= 0 ) {
1227
- ly = lyTop ;
1228
- } else if ( yOffset + tHeight < outerHeight ) {
1229
- ly = yOffset ; // subplot top corner
1219
+ if ( lyBottom + tHeight < outerHeight && lyBottom >= 0 ) {
1220
+ ly = lyBottom ;
1221
+ } else if ( lyTop + tHeight < outerHeight && lyTop >= 0 ) {
1222
+ ly = lyTop ;
1223
+ } else if ( yOffset + tHeight < outerHeight ) {
1224
+ ly = yOffset ; // subplot top corner
1225
+ } else {
1226
+ // closest top or bottom side of the paper
1227
+ if ( lyBottom - avgY < avgY - lyTop + tHeight ) {
1228
+ ly = outerHeight - tHeight ;
1230
1229
} else {
1231
- // closest top or bottom side of the paper
1232
- if ( lyBottom - avgY < avgY - lyTop + tHeight ) {
1233
- ly = outerHeight - tHeight ;
1234
- } else {
1235
- ly = 0 ;
1236
- }
1230
+ ly = 0 ;
1237
1231
}
1238
- } else { // N.B. this case happens on documentation website (outerHeight: 0)
1239
- ly = lyTop ;
1240
1232
}
1241
1233
ly += HOVERTEXTPAD ;
1242
1234
0 commit comments