useContainer(target, transform, opacity) {
    const layerClassName = this.getLayer().getClassName();
    let container, context;
    if (
      target &&
      target.style.opacity === cssOpacity(opacity) &&
      target.className === layerClassName
    ) {
      const canvas = target.firstElementChild;
      if (canvas instanceof HTMLCanvasElement) {
        context = canvas.getContext('2d');
      }
    }
    if (context && context.canvas.style.transform === transform) {
      // Container of the previous layer renderer can be used.
      this.container = target;
      this.context = context;
      this.containerReused = true;
    } else if (this.containerReused) {
      // Previously reused container cannot be used any more.
      this.container = null;
      this.context = null;
      this.containerReused = false;
    }
    if (!this.container) {
      container = document.createElement('div');
      container.className = layerClassName;
      let style = container.style;
      style.position = 'absolute';
      style.width = '100%';
      style.height = '100%';
      context = createCanvasContext2D();
      const canvas = context.canvas;
      container.appendChild(canvas);
      style = canvas.style;
      style.position = 'absolute';
      style.left = '0';
      style.transformOrigin = 'top left';
      this.container = container;
      this.context = context;
    }
  }
/**
   * Get a rendering container from an existing target, if compatible.
   * @param {HTMLElement} target Potential render target.
   * @param {string} transform CSS Transform.
   * @param {number} opacity Opacity.
   */
Get a rendering container from an existing target, if compatible.
@param {HTMLElement} target Potential render target.
@param {string} transform CSS Transform.
@param {number} opacity Opacity.
Get a rendering container from an existing target if compatible . @param { HTMLElement } target Potential render target . @param { string } transform CSS Transform . @param { number } opacity Opacity .
useContainer(target, transform, opacity) {
    const layerClassName = this.getLayer().getClassName();
    let container, context;
    if (
      target &&
      target.style.opacity === cssOpacity(opacity) &&
      target.className === layerClassName
    ) {
      const canvas = target.firstElementChild;
      if (canvas instanceof HTMLCanvasElement) {
        context = canvas.getContext('2d');
      }
    }
    if (context && context.canvas.style.transform === transform) {
      this.container = target;
      this.context = context;
      this.containerReused = true;
    } else if (this.containerReused) {
      this.container = null;
      this.context = null;
      this.containerReused = false;
    }
    if (!this.container) {
      container = document.createElement('div');
      container.className = layerClassName;
      let style = container.style;
      style.position = 'absolute';
      style.width = '100%';
      style.height = '100%';
      context = createCanvasContext2D();
      const canvas = context.canvas;
      container.appendChild(canvas);
      style = canvas.style;
      style.position = 'absolute';
      style.left = '0';
      style.transformOrigin = 'top left';
      this.container = container;
      this.context = context;
    }
  }
useContainer ( target , transform , opacity ) { const layerClassName = this . getLayer ( ) . getClassName ( ) ; let container , context ; if ( target && target . style . opacity === cssOpacity ( opacity ) && target . className === layerClassName ) { const canvas = target . firstElementChild ; if ( canvas instanceof HTMLCanvasElement ) { context = canvas . getContext ( '2d' ) ; } } if ( context && context . canvas . style . transform === transform ) { this . container = target ; this . context = context ; this . containerReused = true ; } else if ( this . containerReused ) { this . container = null ; this . context = null ; this . containerReused = false ; } if ( ! this . container ) { container = document . createElement ( 'div' ) ; container . className = layerClassName ; let style = container . style ; style . position = 'absolute' ; style . width = '100%' ; style . height = '100%' ; context = createCanvasContext2D ( ) ; const canvas = context . canvas ; container . appendChild ( canvas ) ; style = canvas . style ; style . position = 'absolute' ; style . left = '0' ; style . transformOrigin = 'top left' ; this . container = container ; this . context = context ; } }
Get a rendering container from an existing target, if compatible.
Get a rendering container from an existing target if compatible .
// Container of the previous layer renderer can be used. // Previously reused container cannot be used any more.