function textBoxWidth(context, text, padding) {
  var font = _textStyle2.default.getFont();
  var origFont = context.font;

  if (font && font !== origFont) {
    context.font = font;
  }
  var width = context.measureText(text).width;

  if (font && font !== origFont) {
    context.font = origFont;
  }

  return width + 2 * padding;
}
/**
 * Compute the width of the box required to display the given `text` with a given `padding`.
 *
 * @param {CanvasRenderingContext2D} context
 * @param {String} text - The text to find the width of.
 * @param {Number} padding - The padding to apply on either end of the text.
 */
Compute the width of the box required to display the given `text` with a given `padding`.
@param {CanvasRenderingContext2D} context
@param {String} text - The text to find the width of.
@param {Number} padding - The padding to apply on either end of the text.
Compute the width of the box required to display the given ` text ` with a given ` padding ` . @param { CanvasRenderingContext2D } context @param { String } text - The text to find the width of . @param { Number } padding - The padding to apply on either end of the text .
function textBoxWidth(context, text, padding) {
  var font = _textStyle2.default.getFont();
  var origFont = context.font;
  if (font && font !== origFont) {
    context.font = font;
  }
  var width = context.measureText(text).width;
  if (font && font !== origFont) {
    context.font = origFont;
  }
  return width + 2 * padding;
}
function textBoxWidth ( context , text , padding ) { var font = _textStyle2 . default . getFont ( ) ; var origFont = context . font ; if ( font && font !== origFont ) { context . font = font ; } var width = context . measureText ( text ) . width ; if ( font && font !== origFont ) { context . font = origFont ; } return width + 2 * padding ; }
Compute the width of the box required to display the given `text` with a given `padding`.
Compute the width of the box required to display the given ` text ` with a given ` padding ` .