Загрузка данных


private handlePointerMove = (event: PointerEvent): void => {
  const nextPriceScale = this.getHoveredPriceScale(event.clientX);

  if (this.hoveredPriceScale !== nextPriceScale) {
    this.hoveredPriceScale = nextPriceScale;
    this.refresh();
    return;
  }

  if (!nextPriceScale || (event.buttons & 1) === 0) {
    return;
  }

  const isAutoScaleEnabled = nextPriceScale.isAutoScaleEnabled();

  if (this.renderedAutoScaleEnabled === isAutoScaleEnabled) {
    return;
  }

  this.render(nextPriceScale);
};


private render(priceScale: PriceScale): void {
  const priceScaleElement = this.getPriceScaleElement(priceScale);

  if (!priceScaleElement || !this.canShowControls(priceScale, priceScaleElement)) {
    this.hide();
    return;
  }

  if (this.container.parentElement !== priceScaleElement) {
    priceScaleElement.appendChild(this.container);
  }

  const isAutoScaleEnabled = priceScale.isAutoScaleEnabled();

  this.renderedAutoScaleEnabled = isAutoScaleEnabled;

  this.renderer.renderComponent(
    <PriceScaleControlsView
      isAutoScale={isAutoScaleEnabled}
      isLogarithmic={priceScale.getMode() === PriceScaleMode.Logarithmic}
      onToggleAutoScale={() => {
        priceScale.toggleAutoScale();
        this.refresh();
        this.onPriceScaleChange();
      }}
      onToggleLogarithmic={() => {
        priceScale.toggleLogarithmic();
        this.refresh();
        this.onPriceScaleChange();
      }}
    />,
  );

  this.container.classList.add('moex-price-scale-controls_visible');
}