Skip to content

Commit

Permalink
fix: need to reset twice to go back (#2151) (#2173)
Browse files Browse the repository at this point in the history
When the reset button is pressed, the default zoom is set. This causes
the scrolling to change and triggers the onScroll event, which sets the
overall zoom. This problem was solved by setting the "isDefZoom" flag,
which is set to "true" when setting the default scale and does not allow
the onScroll event to change the zoom

Co-authored-by: DShamakin <denis.shamakin@emerson.com>
Co-authored-by: t0oF <93762994+w1nklr@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent f0edabf commit 7308582
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,8 @@ class WellLogView
selPinned: number | undefined; // pinned position
selPersistent: boolean | undefined;

isDefZoom: boolean;

template: Template;

scaleInterpolator: ScaleInterpolator | undefined;
Expand All @@ -1281,6 +1283,8 @@ class WellLogView
this.selPinned = undefined;
this.selPersistent = undefined;

this.isDefZoom = false;

this.resizeObserver = new ResizeObserver(
(entries: ResizeObserverEntry[]): void => {
const entry = entries[0];
Expand Down Expand Up @@ -1554,6 +1558,7 @@ class WellLogView
setControllerDefaultZoom(): void {
if (this.props.domain) this.zoomContentTo(this.props.domain);
else this.zoomContentTo(this.getContentBaseDomain());
this.isDefZoom = true;
}

/**
Expand Down Expand Up @@ -1610,6 +1615,10 @@ class WellLogView
return zoomContentTo(this.logController, domain);
}
scrollContentTo(f: number): boolean {
if (this.isDefZoom) {
this.isDefZoom = false;
return false;
}
if (!this.logController) return false;
return scrollContentTo(this.logController, f);
}
Expand Down

0 comments on commit 7308582

Please sign in to comment.