Continous scroll issue in gantt

If scroll to using mouser or zoom fit, zoomIn and Zoom out its scrolling infinite times Only in Left side. See Sample below


this is continous scroll logic
this.activityGantt.attachEvent(“onGanttScroll”, (left, top) => {

  if (!this.ganttToolBarRef.isZoomBtnClick) {
    const unit = this.activityGantt.getScale().unit;

    const left_date = this.activityGantt.dateFromPos(left);
    const right_date = this.activityGantt.dateFromPos(left + this.activityGantt.$task.offsetWidth);

    this.activityGantt.config.start_date = this.activityGantt.config.start_date || this.activityGantt.getState().min_date;
    this.activityGantt.config.end_date = this.activityGantt.config.end_date || this.activityGantt.getState().max_date;

    const min_allowed_date = this.activityGantt.date.add(this.activityGantt.config.start_date, 1, unit);
    const max_allowed_date = this.activityGantt.date.add(this.activityGantt.config.end_date, -2, unit);
    let repaint = false;
    if (+left_date <= +min_allowed_date) {
      this.activityGantt.config.start_date = this.activityGantt.date.add(this.activityGantt.config.start_date, -2, unit);
      repaint = true;
    }
    if (+right_date >= +max_allowed_date) {
      this.activityGantt.config.end_date = this.activityGantt.date.add(this.activityGantt.config.end_date, 2, unit);
      repaint = true;
    }

    if (repaint) {
      setTimeout(() => {
        this.activityGantt.render();
      }, 100)
    }
  }
});

Hello,
It seems that the issue occurs because the left argument receives the previous scroll value, that’s why we get an infinite loop.
Here is the updated snippet where we get the actual value by using the getScrollState method:
https://snippet.dhtmlx.com/i90opwxb