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


moex-chartsrc/core/Drawings/parallelChannel/parallelChannel.ts
See all issues in this file


    event.stopPropagation();
    this.openSettings?.();
  };
  protected handlePointerDown = (event: PointerEvent): void => {
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.
    
if (this.hidden 
|| event.button !== 0) {
      return;
    }
    const point = this.getEventPoint(event);
    
if (this.mode === 'idle') {
      event.preventDefault();
      event.stopPropagation();
      this.startDrawing(point);
      return;
    }
    
if (this.mode === 'drawing-line') {
      event.preventDefault();
      event.stopPropagation();
      this.setEndAnchor(point);
      
if (!this.hasValidMainLine()) {
        this.render();
        return;
      }
      this.priceOffset = 0;
      this.mode = 'drawing-channel';
      this.render();
      return;
    }
    
if (this.mode === 'drawing-channel') {
      event.preventDefault();
      event.stopPropagation();
      this.setPriceOffset(point);
      
if (!this.hasValidChannelWidth()) {
        this.render();
        return;
      }
      this.finishDrawing();
      return;
    }
    
if (this.mode !== 'ready') {
      return;
    }
    const pointTarget = this.getDrawingHandleAtPoint(point)?.id 
?? null;
    const isChannelHit = this.isPointOnChannel(point);
    const isDrawingHit = pointTarget !== null 
|| isChannelHit;
    
if (!this.isSelected()) {
      
if (!isDrawingHit) {
        return;
      }
      event.preventDefault();
      event.stopPropagation();
      this.select();
      return;
    }
    
if (pointTarget) {
      event.preventDefault();
      event.stopPropagation();
      this.startDragging(pointTarget, point, event.pointerId);
      return;
    }
    
if (isChannelHit) {
Covered code
      event.preventDefault();
      event.stopPropagation();
      this.startDragging('body', point, event.pointerId);
      return;






Intentionality issue | Not complete
Unexpected empty method 'updateAllViews'.
Functions should not be emptytypescript:S1186
Software qualities impacted:
Maintainability
Not assigned
Code Smell
Critical
Tags

suspicious
+
Effort
5min
Introduced
28 minutes ago
Where is the issue?
Why is this an issue?
Activity
More Info
moex-chartsrc/core/Drawings/handles.ts
See all issues in this file


New Code
  public detached(): void {
    this.chart = null;
    this.series = null;
  }
  public updateAllViews(): void {}
Unexpected empty method 'updateAllViews'.
  public paneViews(): readonly IPrimitivePaneView[] {
    return this.paneViewsList;
  }
  public timeAxisPaneViews(): readonly IPrimitivePaneView[] {
    return this.timeAxisPaneViewsList;
  }