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


public activateCursor = (cursorType: CursorType): void => {
  this.removePendingDrawings(false);
  this.activeCursor = cursorType;
  this.activateCurrentCursor();
  this.DOM.refreshEntities();
};

private activateCurrentCursor(): void {
  this.applyCursor(this.activeCursor);
  this.activeTool$.next(this.activeCursor);
}

private applyCursor(cursorType: CursorType): void {
  const config = cursorConfigByType[cursorType];

  this.lwcChart.applyOptions({
    crosshair: {
      mode: config.crosshairMode,
    },
  });

  this.lwcChart.chartElement().style.cursor = config.cursor;
}


private updateActiveTool = (): void => {
  const hasPendingDrawing = this.drawings$.value.some((drawing) => drawing.isCreationPending());

  if (hasPendingDrawing) {
    return;
  }

  const activeTool = this.activeTool$.value;
  const isSingleInstanceTool = isDrawingTool(activeTool) && drawingsMap[activeTool]?.singleInstance;

  if (isDrawingTool(activeTool) && this.endlessMode$.value && !isSingleInstanceTool) {
    if (this.recreateScheduled) {
      return;
    }

    this.recreateScheduled = true;

    queueMicrotask(() => {
      this.recreateScheduled = false;

      const currentTool = this.activeTool$.value;
      const hasPendingAfterTick = this.drawings$.value.some((drawing) => drawing.isCreationPending());

      if (!isDrawingTool(currentTool)) {
        return;
      }

      if (!this.endlessMode$.value) {
        return;
      }

      if (drawingsMap[currentTool]?.singleInstance) {
        return;
      }

      if (hasPendingAfterTick) {
        return;
      }

      this.addDrawingForce(currentTool);
    });

    return;
  }

  this.activateCurrentCursor();
};


public updateTheme(theme: ThemeKey, mode: ThemeMode) {
  this.chartConfig = {
    ...this.chartConfig,
    theme,
    mode,
  };

  const crosshairMode = this.lwcChart.options().crosshair.mode;
  const options = getOptions(this.chartConfig);

  this.lwcChart.applyOptions({
    ...options,
    crosshair: {
      ...options.crosshair,
      mode: crosshairMode,
    },
  });

  this.paneManager.invalidate();
}