onSizeChange()

in packages/synchro-charts/src/components/charts/sc-webgl-base-chart/sc-webgl-base-chart.tsx [308:321]


  onSizeChange(newProp: SizeConfig | LegendConfig, oldProp: SizeConfig | LegendConfig) {
    // NOTE: Change of legend can effect sizing
    if (!isEqual(newProp, oldProp)) {
      this.onUpdate(this.activeViewPort(), false, true);
    }
    // Since internal clocks are depended on width, when we detect a width change, we want to re-start the timer.
    if (newProp.width != null && newProp.width !== oldProp.width) {
      const { duration } = this.activeViewPort();
      if (this.scene != null && duration != null) {
        webGLRenderer.stopTick({ manager: this.scene });
        webGLRenderer.startTick({ manager: this.scene, duration, chartSize: this.chartSizeConfig() });
      }
    }
  }