diff --git a/typescript/packages/well-log-viewer/src/SyncLogViewer.stories.tsx b/typescript/packages/well-log-viewer/src/SyncLogViewer.stories.tsx index 6ccfebe19..ea0d504dd 100644 --- a/typescript/packages/well-log-viewer/src/SyncLogViewer.stories.tsx +++ b/typescript/packages/well-log-viewer/src/SyncLogViewer.stories.tsx @@ -10,6 +10,7 @@ const wellpick = require("../../../../example-data/wellpicks.json");// eslint-di import { ToggleButton } from "@mui/material"; import SyncLogViewer, { argTypesSyncLogViewerProp } from "./SyncLogViewer"; +import type { WellLogController } from "./components/WellLogView"; const ComponentCode = ' { const setInfo = function (info) { if (infoRef.current) infoRef.current.innerHTML = info; }; + const [controller, setController] = React.useState(null); // the first WellLog + const [controllers, setControllers] = React.useState( + [] + ); // all WellLogs + const onCreateController = React.useCallback( (iWellLog, controller) => { if (iWellLog === 0) setController(controller); + + setControllers((prev) => [...prev, controller]); }, [controller] ); @@ -175,6 +183,13 @@ const Template = (args) => { }, [controller] ); + const handleClick = function () { + for (const ctrl of controllers) { + if (ctrl) { + ctrl.setControllerDefaultZoom(); + } + } + }; return (
{ />
{/* Print info for the first WellLog */} -
+
+
+ +
); }; @@ -472,6 +492,14 @@ const TemplateWithSelection = (args) => { const [showWell2, setShowWell2] = React.useState(true); const [showWell3, setShowWell3] = React.useState(true); + const [controllers, setControllers] = React.useState( + [] + ); // all WellLogs + + const onCreateController = React.useCallback((iWellLog, controller) => { + setControllers((prev) => [...prev, controller]); + }, []); + const filtered: WellLog[] = []; if (showWell1) { filtered.push(args.welllogs[0]); @@ -482,6 +510,13 @@ const TemplateWithSelection = (args) => { if (showWell3) { filtered.push(args.welllogs[2]); } + const handleClick = function () { + for (const ctrl of controllers) { + if (ctrl) { + ctrl.setControllerDefaultZoom(); + } + } + }; const argsWithSelection = { ...args, @@ -520,9 +555,16 @@ const TemplateWithSelection = (args) => { > Well 3 +
- +
); diff --git a/typescript/packages/well-log-viewer/src/WellLogViewer.stories.tsx b/typescript/packages/well-log-viewer/src/WellLogViewer.stories.tsx index 34ecd7fa7..5e55e4456 100644 --- a/typescript/packages/well-log-viewer/src/WellLogViewer.stories.tsx +++ b/typescript/packages/well-log-viewer/src/WellLogViewer.stories.tsx @@ -127,12 +127,15 @@ const StoryTemplate = (args) => { const onContentSelection = React.useCallback(() => { setInfo(fillInfo(controller)); }, [controller]); + const handleClick = () => { + if (controller) { + controller.setControllerDefaultZoom(); + } + }; return ( -
-
+
+
{ onContentSelection={onContentSelection} />
-
+
+
+ +
); }; diff --git a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--custom-layout.png b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--custom-layout.png index 186c08cec..ebf6e3577 100644 Binary files a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--custom-layout.png and b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--custom-layout.png differ diff --git a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--discrete-logs.png b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--discrete-logs.png index ef33dc138..804ec1e67 100644 Binary files a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--discrete-logs.png and b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-synclogviewer--discrete-logs.png differ diff --git a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--default.png b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--default.png index 8a3af6075..79b795f7d 100644 Binary files a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--default.png and b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--default.png differ diff --git a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--discrete.png b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--discrete.png index c7b557f72..037c857a2 100644 Binary files a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--discrete.png and b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--discrete.png differ diff --git a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--horizontal.png b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--horizontal.png index 642ba426d..57243aac8 100644 Binary files a/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--horizontal.png and b/typescript/packages/well-log-viewer/src/__image_snapshots__/welllogviewer-demo-welllogviewer--horizontal.png differ diff --git a/typescript/packages/well-log-viewer/src/components/WellLogView.tsx b/typescript/packages/well-log-viewer/src/components/WellLogView.tsx index e1dc4d065..7557989c4 100644 --- a/typescript/packages/well-log-viewer/src/components/WellLogView.tsx +++ b/typescript/packages/well-log-viewer/src/components/WellLogView.tsx @@ -1528,6 +1528,10 @@ class WellLogView setControllerSelection(): void { if (this.props.selection) this.selectContent(this.props.selection); } + setControllerDefaultZoom(): void { + if (this.props.domain) this.zoomContentTo(this.props.domain); + else this.zoomContentTo(this.getContentBaseDomain()); + } /** Display current state of track scrolling