static paintGateTooltip(painter, area, gate, time, mayNeedToScale=true) {
        painter.ctx.save();
        painter.ctx.translate(area.x, area.y);
        area = area.withX(0).withY(0);
        let scale = Math.min(area.w/500, area.h/300);
        if (mayNeedToScale && scale < 1) {
            painter.ctx.scale(scale, scale);
            area = area.withH(area.h/scale).withW(area.w/scale);
        }
        let w = area.w;

        let {maxX, maxY} = WidgetPainter.paintGateTooltipHelper(painter, w, gate, time);
        let r = new Rect(0, 0, maxX, maxY);
        painter.fillRect(r, '#F9FFF9');
        painter.strokeRect(r, 'black');
        WidgetPainter.paintGateTooltipHelper(painter, w, gate, time);

        painter.ctx.restore();
        return {maxW: maxX, maxH: maxY};
    }
@param {!Painter} painter
@param {!Rect} area
@param {!Gate} gate
@param {!number} time
@param {!boolean=true} mayNeedToScale
@returns {!{maxW: number, maxH: number}}