updateSize({ rect, dpiRatio, canvasBufferSize }) {
    let bufferSize;
    if (canvasBufferSize) {
      bufferSize = typeof canvasBufferSize === 'function' ? canvasBufferSize(rect) : canvasBufferSize;
    } else {
      bufferSize = {
        width: rect.computedPhysical.width + DEFAULT_PADDING.horizontal * 2,
        height: rect.computedPhysical.height + DEFAULT_PADDING.vertical * 2,
      };
    }

    this.bufferCanvas.style.width = `${bufferSize.width}px`;
    this.bufferCanvas.style.height = `${bufferSize.height}px`;
    this.bufferCanvas.width = Math.round(bufferSize.width * dpiRatio);
    this.bufferCanvas.height = Math.round(bufferSize.height * dpiRatio);
  }
/**
   * @param {object|function} [canvasBufferSize] object containing width and height or a function which returns it
   */
@param {object|function} [canvasBufferSize] object containing width and height or a function which returns it
@param { object|function } [ canvasBufferSize ] object containing width and height or a function which returns it
updateSize({ rect, dpiRatio, canvasBufferSize }) {
    let bufferSize;
    if (canvasBufferSize) {
      bufferSize = typeof canvasBufferSize === 'function' ? canvasBufferSize(rect) : canvasBufferSize;
    } else {
      bufferSize = {
        width: rect.computedPhysical.width + DEFAULT_PADDING.horizontal * 2,
        height: rect.computedPhysical.height + DEFAULT_PADDING.vertical * 2,
      };
    }
    this.bufferCanvas.style.width = `${bufferSize.width}px`;
    this.bufferCanvas.style.height = `${bufferSize.height}px`;
    this.bufferCanvas.width = Math.round(bufferSize.width * dpiRatio);
    this.bufferCanvas.height = Math.round(bufferSize.height * dpiRatio);
  }
updateSize ( { rect , dpiRatio , canvasBufferSize } ) { let bufferSize ; if ( canvasBufferSize ) { bufferSize = typeof canvasBufferSize === 'function' ? canvasBufferSize ( rect ) : canvasBufferSize ; } else { bufferSize = { width : rect . computedPhysical . width + DEFAULT_PADDING . horizontal * 2 , height : rect . computedPhysical . height + DEFAULT_PADDING . vertical * 2 , } ; } this . bufferCanvas . style . width = ` ${ bufferSize . width } ` ; this . bufferCanvas . style . height = ` ${ bufferSize . height } ` ; this . bufferCanvas . width = Math . round ( bufferSize . width * dpiRatio ) ; this . bufferCanvas . height = Math . round ( bufferSize . height * dpiRatio ) ; }
@param {object|function} [canvasBufferSize] object containing width and height or a function which returns it
@param { object|function } [ canvasBufferSize ] object containing width and height or a function which returns it