From 7308582ae2464fb2661de3fa0e9fe39563719c49 Mon Sep 17 00:00:00 2001 From: Denis-Shamakin <160724076+Denis-Shamakin@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:20:59 +0500 Subject: [PATCH] fix: need to reset twice to go back (#2151) (#2173) 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 Co-authored-by: t0oF <93762994+w1nklr@users.noreply.github.com> --- .../well-log-viewer/src/components/WellLogView.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/typescript/packages/well-log-viewer/src/components/WellLogView.tsx b/typescript/packages/well-log-viewer/src/components/WellLogView.tsx index a69817d82..9c0afb612 100644 --- a/typescript/packages/well-log-viewer/src/components/WellLogView.tsx +++ b/typescript/packages/well-log-viewer/src/components/WellLogView.tsx @@ -1267,6 +1267,8 @@ class WellLogView selPinned: number | undefined; // pinned position selPersistent: boolean | undefined; + isDefZoom: boolean; + template: Template; scaleInterpolator: ScaleInterpolator | undefined; @@ -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]; @@ -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; } /** @@ -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); }