if (box) {
img.style.top = Math.min(top + height, screen_size[1] - 24) / dpr + "px";
- img.style.width = (width / dpr) + "px";
img.style.height = "24px";
+ img.style.width = null;
+ img.style.whiteSpace = 'nowrap';
+ if (offset == 0) {
+ // Hide the box if there's no room for all the text.
+ img.style.opacity = (img.clientWidth < width / dpr + 10) ? null : 0.0;
+ }
+ img.style.width = (width / dpr) + "px";
} else {
img.style.top = (top / dpr) + "px";
img.style.lineHeight = (height / dpr) + "px";