@webviz/well-log-viewer 0.0.1-alpha.1 → 0.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SyncLogViewer.js +3 -4
- package/dist/SyncLogViewer.js.map +1 -1
- package/dist/components/WellLogView.js +5 -5
- package/dist/components/WellLogView.js.map +1 -1
- package/dist/demo/example-data/welllog_template_2.json +167 -167
- package/dist/demo/example-data/wellpick_colors.json +1 -1
- package/dist/demo/example-data/wellpicks.json +179 -179
- package/package.json +32 -5
- package/dist/Intro.stories.mdx +0 -59
- package/dist/package.json +0 -21
- package/src/Intro.stories.mdx +0 -59
- package/src/MapAndWellLogViewer.stories.jsx +0 -147
- package/src/MapAndWellLogViewer.test.tsx +0 -26
- package/src/MapAndWellLogViewer.tsx +0 -473
- package/src/SyncLogViewer.stories.jsx +0 -361
- package/src/SyncLogViewer.test.tsx +0 -41
- package/src/SyncLogViewer.tsx +0 -1188
- package/src/WellLogViewer.png +0 -0
- package/src/WellLogViewer.stories.jsx +0 -169
- package/src/WellLogViewer.test.tsx +0 -53
- package/src/WellLogViewer.tsx +0 -439
- package/src/WellLogViewer_performance.test.tsx +0 -78
- package/src/__snapshots__/MapAndWellLogViewer.test.tsx.snap +0 -365
- package/src/__snapshots__/SyncLogViewer.test.tsx.snap +0 -510
- package/src/__snapshots__/WellLogViewer.test.tsx.snap +0 -552
- package/src/components/AxisSelector.test.tsx +0 -50
- package/src/components/AxisSelector.tsx +0 -49
- package/src/components/ColorTableTypes.ts +0 -9
- package/src/components/InfoPanel.test.tsx +0 -58
- package/src/components/InfoPanel.tsx +0 -144
- package/src/components/InfoTypes.ts +0 -17
- package/src/components/LocalMenus.tsx +0 -336
- package/src/components/PlotDialog.tsx +0 -419
- package/src/components/Scroller.stories.jsx +0 -80
- package/src/components/Scroller.test.tsx +0 -22
- package/src/components/Scroller.tsx +0 -173
- package/src/components/TrackDialog.tsx +0 -217
- package/src/components/WellLogSpacer.tsx +0 -483
- package/src/components/WellLogTemplateTypes.ts +0 -65
- package/src/components/WellLogTypes.ts +0 -53
- package/src/components/WellLogView.stories.jsx +0 -84
- package/src/components/WellLogView.test.tsx +0 -52
- package/src/components/WellLogView.tsx +0 -2063
- package/src/components/WellLogViewWithScroller.stories.jsx +0 -69
- package/src/components/WellLogViewWithScroller.test.tsx +0 -47
- package/src/components/WellLogViewWithScroller.tsx +0 -179
- package/src/components/ZoomSlider.stories.jsx +0 -52
- package/src/components/ZoomSlider.test.tsx +0 -28
- package/src/components/ZoomSlider.tsx +0 -86
- package/src/components/__snapshots__/AxisSelector.test.tsx.snap +0 -28
- package/src/components/__snapshots__/InfoPanel.test.tsx.snap +0 -103
- package/src/components/__snapshots__/Scroller.test.tsx.snap +0 -13
- package/src/components/__snapshots__/WellLogView.test.tsx.snap +0 -54
- package/src/components/__snapshots__/WellLogViewWithScroller.test.tsx.snap +0 -270
- package/src/components/__snapshots__/ZoomSlider.test.tsx.snap +0 -50
- package/src/components/styles.scss +0 -106
- package/src/custom.d.ts +0 -13
- package/src/demo/example-data/volve_logs.json +0 -689617
- package/src/demo/example-data/welllog_template_2.json +0 -196
- package/src/demo/example-data/wellpick_colors.json +0 -156
- package/src/demo/example-data/wellpicks.json +0 -186
- package/src/index.ts +0 -8
- package/src/utils/axes.ts +0 -26
- package/src/utils/color-table.ts +0 -153
- package/src/utils/deepcopy.ts +0 -3
- package/src/utils/edit-track.tsx +0 -40
- package/src/utils/fill-info.ts +0 -224
- package/src/utils/gradientfill-plot-legend.ts +0 -177
- package/src/utils/gradientfill-plot.ts +0 -203
- package/src/utils/graph/factory.ts +0 -15
- package/src/utils/legend/common.ts +0 -153
- package/src/utils/log-viewer.ts +0 -209
- package/src/utils/minmax.ts +0 -126
- package/src/utils/pattern.tsx +0 -50
- package/src/utils/stack/stack-legend.ts +0 -100
- package/src/utils/tracks.ts +0 -1559
- package/tsconfig.json +0 -8
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import WellLogViewWithScroller from "./WellLogViewWithScroller";
|
|
3
|
-
import { argTypesWellLogViewScrollerProp } from "./WellLogViewWithScroller";
|
|
4
|
-
import { colorTables } from "@emerson-eps/color-tables";
|
|
5
|
-
|
|
6
|
-
const ComponentCode =
|
|
7
|
-
'<WellLogViewWithScroller id="WellLogViewWithScroller" \r\n' +
|
|
8
|
-
" horizontal=false \r\n" +
|
|
9
|
-
' welllog={require("../../../../../example-data/L898MUD.json")[0]} \r\n' +
|
|
10
|
-
' template={require("../../../../../example-data/welllog_template_1.json")} \r\n' +
|
|
11
|
-
" colorTables={colorTables} \r\n" +
|
|
12
|
-
"/>";
|
|
13
|
-
|
|
14
|
-
import { axisTitles, axisMnemos } from "../utils/axes";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
component: WellLogViewWithScroller,
|
|
18
|
-
title: "WellLogViewer/Components/WellLogViewWithScroller",
|
|
19
|
-
parameters: {
|
|
20
|
-
docs: {
|
|
21
|
-
description: {
|
|
22
|
-
component:
|
|
23
|
-
"The component add scrollbars to WellLogView component to make tracks and plots scrollable by scrollbars.",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
componentSource: {
|
|
27
|
-
code: ComponentCode,
|
|
28
|
-
language: "javascript",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
argTypes: {
|
|
32
|
-
...argTypesWellLogViewScrollerProp,
|
|
33
|
-
id: {
|
|
34
|
-
description:
|
|
35
|
-
"The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app.",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const Template = (args) => {
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
style={{ height: "92vh", display: "flex", flexDirection: "column" }}
|
|
44
|
-
>
|
|
45
|
-
<div style={{ width: "100%", height: "100%" }}>
|
|
46
|
-
<WellLogViewWithScroller
|
|
47
|
-
id="WellLogViewWithScroller"
|
|
48
|
-
{...args}
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const wellLog = require("../../../../../example-data/L898MUD.json")[0];
|
|
56
|
-
export const Default = Template.bind({});
|
|
57
|
-
Default.args = {
|
|
58
|
-
id: "Well-Log-Viewer-With-Scroller",
|
|
59
|
-
horizontal: false,
|
|
60
|
-
welllog: wellLog,
|
|
61
|
-
template: require("../../../../../example-data/welllog_template_1.json"),
|
|
62
|
-
viewTitle: "Well '" + wellLog.header.well + "'",
|
|
63
|
-
colorTables: colorTables,
|
|
64
|
-
axisTitles: axisTitles,
|
|
65
|
-
axisMnemos: axisMnemos,
|
|
66
|
-
options: {
|
|
67
|
-
checkDatafileSchema: true,
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
import "@testing-library/jest-dom/extend-expect";
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import "jest-styled-components";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import WellLogViewWithScroller from "./WellLogViewWithScroller";
|
|
7
|
-
import { colorTables } from "@emerson-eps/color-tables";
|
|
8
|
-
|
|
9
|
-
const welllog = require("../../../../../example-data/L898MUD.json")[0];
|
|
10
|
-
const template = require("../../../../../example-data/welllog_template_1.json");
|
|
11
|
-
|
|
12
|
-
window.ResizeObserver =
|
|
13
|
-
window.ResizeObserver ||
|
|
14
|
-
jest.fn().mockImplementation(() => ({
|
|
15
|
-
disconnect: jest.fn(),
|
|
16
|
-
observe: jest.fn(),
|
|
17
|
-
unobserve: jest.fn(),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
describe("Test Well Log View Component with Scroller", () => {
|
|
21
|
-
it("snapshot test", () => {
|
|
22
|
-
const { container } = render(
|
|
23
|
-
<WellLogViewWithScroller
|
|
24
|
-
welllog={welllog}
|
|
25
|
-
template={template}
|
|
26
|
-
colorTables={colorTables}
|
|
27
|
-
primaryAxis={"md"}
|
|
28
|
-
axisTitles={{
|
|
29
|
-
md: "MD",
|
|
30
|
-
tvd: "TVD",
|
|
31
|
-
time: "TIME",
|
|
32
|
-
}}
|
|
33
|
-
axisMnemos={{
|
|
34
|
-
md: ["DEPTH", "DEPT", "MD", "TDEP", "MD_RKB"],
|
|
35
|
-
tvd: ["TVD", "TVDSS", "DVER", "TVD_MSL"],
|
|
36
|
-
time: ["TIME"],
|
|
37
|
-
}}
|
|
38
|
-
options={{
|
|
39
|
-
checkDatafileSchema: true,
|
|
40
|
-
hideTrackLegend: true,
|
|
41
|
-
hideTrackTitle: true,
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
|
|
3
|
-
import WellLogView from "./WellLogView";
|
|
4
|
-
import { WellLogViewProps, argTypesWellLogViewProp } from "./WellLogView";
|
|
5
|
-
import { _propTypesWellLogView } from "./WellLogView";
|
|
6
|
-
|
|
7
|
-
import { WellLogController } from "./WellLogView";
|
|
8
|
-
|
|
9
|
-
import Scroller from "./Scroller";
|
|
10
|
-
|
|
11
|
-
export type WellLogViewWithScrollerProps = WellLogViewProps;
|
|
12
|
-
export const argTypesWellLogViewScrollerProp = argTypesWellLogViewProp;
|
|
13
|
-
|
|
14
|
-
class WellLogViewWithScroller extends Component<WellLogViewWithScrollerProps> {
|
|
15
|
-
public static propTypes: Record<string, unknown>;
|
|
16
|
-
|
|
17
|
-
controller: WellLogController | null;
|
|
18
|
-
scroller: Scroller | null;
|
|
19
|
-
|
|
20
|
-
constructor(props: WellLogViewWithScrollerProps) {
|
|
21
|
-
super(props);
|
|
22
|
-
|
|
23
|
-
this.controller = null;
|
|
24
|
-
this.scroller = null;
|
|
25
|
-
|
|
26
|
-
this.onCreateController = this.onCreateController.bind(this);
|
|
27
|
-
|
|
28
|
-
this.onScrollerScroll = this.onScrollerScroll.bind(this);
|
|
29
|
-
this.onTrackScroll = this.onTrackScroll.bind(this);
|
|
30
|
-
this.onTrackSelection = this.onTrackSelection.bind(this);
|
|
31
|
-
|
|
32
|
-
this.onContentRescale = this.onContentRescale.bind(this);
|
|
33
|
-
this.onContentSelection = this.onContentSelection.bind(this);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
componentDidMount(): void {
|
|
37
|
-
this.setScrollerPosAndZoom();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
shouldComponentUpdate(nextProps: WellLogViewWithScrollerProps): boolean {
|
|
41
|
-
return !Object.is(this.props, nextProps);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
updateReadoutPanel(): void {
|
|
45
|
-
const controller = this.controller;
|
|
46
|
-
if (controller)
|
|
47
|
-
controller.selectContent(controller.getContentSelection()); // force to update readout panel
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// callback function from WellLogView
|
|
51
|
-
onCreateController(controller: WellLogController): void {
|
|
52
|
-
this.controller = controller;
|
|
53
|
-
if (this.props.onCreateController)
|
|
54
|
-
// set callback to component's caller
|
|
55
|
-
this.props.onCreateController(controller);
|
|
56
|
-
}
|
|
57
|
-
// callback function from WellLogView
|
|
58
|
-
onTrackScroll(): void {
|
|
59
|
-
this.setScrollerPosAndZoom();
|
|
60
|
-
if (this.props.onTrackScroll) this.props.onTrackScroll();
|
|
61
|
-
}
|
|
62
|
-
// callback function from WellLogView
|
|
63
|
-
onTrackSelection(): void {
|
|
64
|
-
if (this.props.onTrackSelection) this.props.onTrackSelection();
|
|
65
|
-
}
|
|
66
|
-
// callback function from WellLogView
|
|
67
|
-
onContentRescale(): void {
|
|
68
|
-
this.setScrollerPosAndZoom();
|
|
69
|
-
if (this.props.onContentRescale) this.props.onContentRescale();
|
|
70
|
-
}
|
|
71
|
-
// callback function from WellLogView
|
|
72
|
-
onContentSelection(): void {
|
|
73
|
-
if (this.props.onContentSelection) this.props.onContentSelection();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// callback function from Scroller
|
|
77
|
-
onScrollerScroll(x: number, y: number): void {
|
|
78
|
-
const controller = this.controller;
|
|
79
|
-
if (!controller) return;
|
|
80
|
-
const fContent = this.props.horizontal ? x : y; // fraction
|
|
81
|
-
controller.scrollContentTo(fContent);
|
|
82
|
-
const posTrack = this.calcPosTrack(this.props.horizontal ? y : x);
|
|
83
|
-
controller.scrollTrackTo(posTrack);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
calcPosTrack(f: number): number {
|
|
87
|
-
const controller = this.controller;
|
|
88
|
-
if (!controller) return 0;
|
|
89
|
-
const posMax = controller.getTrackScrollPosMax();
|
|
90
|
-
const posTrack = f * posMax;
|
|
91
|
-
return Math.round(posTrack);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
getContentPosFraction(): number {
|
|
95
|
-
const controller = this.controller;
|
|
96
|
-
if (!controller) return 0;
|
|
97
|
-
const baseDomain = controller.getContentBaseDomain();
|
|
98
|
-
const domain = controller.getContentDomain();
|
|
99
|
-
const w = baseDomain[1] - baseDomain[0] - (domain[1] - domain[0]);
|
|
100
|
-
return w ? (domain[0] - baseDomain[0]) / w : 0;
|
|
101
|
-
}
|
|
102
|
-
getTrackPosFraction(): number {
|
|
103
|
-
const controller = this.controller;
|
|
104
|
-
if (!controller) return 0;
|
|
105
|
-
return controller.getTrackScrollPosMax()
|
|
106
|
-
? controller.getTrackScrollPos() / controller.getTrackScrollPosMax()
|
|
107
|
-
: 0.0;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setScrollerPosAndZoom(): void {
|
|
111
|
-
let x: number, y: number;
|
|
112
|
-
let xZoom: number, yZoom: number;
|
|
113
|
-
const scroller = this.scroller;
|
|
114
|
-
if (!scroller) return;
|
|
115
|
-
const controller = this.controller;
|
|
116
|
-
if (!controller) {
|
|
117
|
-
x = y = 0.0;
|
|
118
|
-
xZoom = yZoom = 1.0;
|
|
119
|
-
} else {
|
|
120
|
-
const contentZoom = controller.getContentZoom();
|
|
121
|
-
const trackZoom = controller.getTrackZoom();
|
|
122
|
-
xZoom = this.props.horizontal ? contentZoom : trackZoom;
|
|
123
|
-
yZoom = this.props.horizontal ? trackZoom : contentZoom;
|
|
124
|
-
|
|
125
|
-
const fContent = this.getContentPosFraction();
|
|
126
|
-
const fTrack = this.getTrackPosFraction();
|
|
127
|
-
x = this.props.horizontal ? fContent : fTrack;
|
|
128
|
-
y = this.props.horizontal ? fTrack : fContent;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
scroller.zoom(xZoom, yZoom);
|
|
132
|
-
|
|
133
|
-
let shouldUpdateScroller = 2;
|
|
134
|
-
{
|
|
135
|
-
// compare with current values from scroller
|
|
136
|
-
const _x = scroller.getScrollX();
|
|
137
|
-
const _y = scroller.getScrollY();
|
|
138
|
-
const _posTrack = this.calcPosTrack(
|
|
139
|
-
this.props.horizontal ? _y : _x
|
|
140
|
-
);
|
|
141
|
-
const posTrack = this.calcPosTrack(this.props.horizontal ? y : x);
|
|
142
|
-
if (posTrack === _posTrack) {
|
|
143
|
-
shouldUpdateScroller--;
|
|
144
|
-
this.props.horizontal ? (y = _y) : (x = _x);
|
|
145
|
-
}
|
|
146
|
-
const _fContent = this.props.horizontal ? _x : _y;
|
|
147
|
-
const fContent = this.props.horizontal ? x : y;
|
|
148
|
-
if (Math.abs(fContent - _fContent) < 0.001) {
|
|
149
|
-
shouldUpdateScroller--;
|
|
150
|
-
this.props.horizontal ? (x = _x) : (y = _y);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (shouldUpdateScroller) scroller.scrollTo(x, y);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
render(): JSX.Element {
|
|
157
|
-
return (
|
|
158
|
-
<Scroller
|
|
159
|
-
ref={(el) => (this.scroller = el as Scroller)}
|
|
160
|
-
onScroll={this.onScrollerScroll}
|
|
161
|
-
>
|
|
162
|
-
<WellLogView
|
|
163
|
-
// copy all props
|
|
164
|
-
{...this.props}
|
|
165
|
-
// redefine some callbacks
|
|
166
|
-
onCreateController={this.onCreateController}
|
|
167
|
-
onTrackScroll={this.onTrackScroll}
|
|
168
|
-
onTrackSelection={this.onTrackSelection}
|
|
169
|
-
onContentRescale={this.onContentRescale}
|
|
170
|
-
onContentSelection={this.onContentSelection}
|
|
171
|
-
/>
|
|
172
|
-
</Scroller>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
WellLogViewWithScroller.propTypes = _propTypesWellLogView(); // WellLogView.propTypes;
|
|
178
|
-
|
|
179
|
-
export default WellLogViewWithScroller;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ZoomSlider from "./ZoomSlider";
|
|
3
|
-
|
|
4
|
-
const ComponentCode = "<ZoomSlider value={1} max={128}/>";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: ZoomSlider,
|
|
8
|
-
title: "WellLogViewer/Components/ZoomSlider",
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component:
|
|
13
|
-
"An auxiliary component for WellLogViewer demo component. Used for setting a zoom factor to well log tracks",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
componentSource: {
|
|
17
|
-
code: ComponentCode,
|
|
18
|
-
language: "javascript",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
value: {
|
|
23
|
-
description: "Zoom value (default 1)",
|
|
24
|
-
},
|
|
25
|
-
max: {
|
|
26
|
-
description: "Max zoom value (default 256)",
|
|
27
|
-
},
|
|
28
|
-
onChange: {
|
|
29
|
-
description: "zoom value callback",
|
|
30
|
-
},
|
|
31
|
-
step: {
|
|
32
|
-
description: "zoom level step (default 0.5)",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const Template = (args) => {
|
|
38
|
-
return (
|
|
39
|
-
<div style={{ height: "92vh" }}>
|
|
40
|
-
<div style={{ width: "97%", height: "100%", flex: 1 }}>
|
|
41
|
-
Zoom:
|
|
42
|
-
<ZoomSlider id="ZoomSlider" {...args} />
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Default = Template.bind({});
|
|
49
|
-
Default.args = {
|
|
50
|
-
value: 1,
|
|
51
|
-
max: 128,
|
|
52
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
import "@testing-library/jest-dom/extend-expect";
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import "jest-styled-components";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import ZoomSlider from "./ZoomSlider";
|
|
7
|
-
|
|
8
|
-
window.ResizeObserver =
|
|
9
|
-
window.ResizeObserver ||
|
|
10
|
-
jest.fn().mockImplementation(() => ({
|
|
11
|
-
disconnect: jest.fn(),
|
|
12
|
-
observe: jest.fn(),
|
|
13
|
-
unobserve: jest.fn(),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
describe("Test zoom slider", () => {
|
|
17
|
-
it("snapshot test", () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<ZoomSlider
|
|
20
|
-
onChange={function (): void {
|
|
21
|
-
throw new Error("Function not implemented.");
|
|
22
|
-
}}
|
|
23
|
-
value={0}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
|
|
3
|
-
import Slider from "@mui/material/Slider";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
onChange: (value: number) => void;
|
|
7
|
-
value: number; // zoom value.
|
|
8
|
-
|
|
9
|
-
max?: number; // max zoom value. default 256
|
|
10
|
-
step?: number; // step of zoom level. default 0.5
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface State {
|
|
14
|
-
level: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function convertLevelToValue(level: number): number {
|
|
18
|
-
// convert zoom level to zoom value
|
|
19
|
-
return 2 ** level;
|
|
20
|
-
}
|
|
21
|
-
function convertValueToLevel(value: number): number {
|
|
22
|
-
// convert zoom value to zoom level
|
|
23
|
-
return value > 0 ? Math.log2(value) : 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function valueLabelFormat(value: number /*, index: number*/): string {
|
|
27
|
-
return value.toFixed(Number.isInteger(value) || value > 20 ? 0 : 1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
class ZoomSlider extends Component<Props, State> {
|
|
31
|
-
constructor(props: Props, state: State) {
|
|
32
|
-
super(props, state);
|
|
33
|
-
|
|
34
|
-
const level = convertValueToLevel(this.props.value);
|
|
35
|
-
this.state = {
|
|
36
|
-
level: level,
|
|
37
|
-
};
|
|
38
|
-
this.onChange = this.onChange.bind(this);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
componentDidUpdate(prevProps: Props): void {
|
|
42
|
-
if (this.props.value !== prevProps.value) {
|
|
43
|
-
this.setState((state: Readonly<State>) => {
|
|
44
|
-
const level = convertValueToLevel(this.props.value);
|
|
45
|
-
if (state.level == level) return null;
|
|
46
|
-
return { level: level };
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// callback function from Zoom slider
|
|
52
|
-
onChange(
|
|
53
|
-
_event: Event,
|
|
54
|
-
level: number | number[] // zoom level
|
|
55
|
-
): void {
|
|
56
|
-
if (typeof level === "number") {
|
|
57
|
-
this.setState((state: Readonly<State>) => {
|
|
58
|
-
if (state.level === level) return null;
|
|
59
|
-
if (this.props.onChange)
|
|
60
|
-
this.props.onChange(convertLevelToValue(level));
|
|
61
|
-
else console.error("ZoomSlider props.onChange not set");
|
|
62
|
-
return { level: level as number };
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
render(): JSX.Element {
|
|
68
|
-
return (
|
|
69
|
-
<Slider
|
|
70
|
-
value={this.state.level}
|
|
71
|
-
defaultValue={0}
|
|
72
|
-
min={0}
|
|
73
|
-
step={this.props.step || 0.5}
|
|
74
|
-
max={convertValueToLevel(this.props.max || 256)}
|
|
75
|
-
scale={convertLevelToValue} // convert zoom level to zoom value function
|
|
76
|
-
onChange={this.onChange}
|
|
77
|
-
getAriaValueText={valueLabelFormat}
|
|
78
|
-
valueLabelFormat={valueLabelFormat}
|
|
79
|
-
aria-labelledby="non-linear-slider"
|
|
80
|
-
valueLabelDisplay="auto"
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default ZoomSlider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Test Axis Selector snapshot test 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<fieldset>
|
|
6
|
-
<legend>
|
|
7
|
-
Primary scale
|
|
8
|
-
</legend>
|
|
9
|
-
<div>
|
|
10
|
-
<input
|
|
11
|
-
checked=""
|
|
12
|
-
type="radio"
|
|
13
|
-
value="md"
|
|
14
|
-
/>
|
|
15
|
-
MD
|
|
16
|
-
</div>
|
|
17
|
-
<div>
|
|
18
|
-
<input
|
|
19
|
-
type="radio"
|
|
20
|
-
value="tvd"
|
|
21
|
-
/>
|
|
22
|
-
TVD
|
|
23
|
-
</div>
|
|
24
|
-
</fieldset>
|
|
25
|
-
</div>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
exports[`Test Axis Selector test when there no axes- empty rendering 1`] = `null`;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Test Info panel snapshot test 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
style="overflow-y: auto; overflow-x: hidden;"
|
|
6
|
-
>
|
|
7
|
-
<fieldset>
|
|
8
|
-
<legend>
|
|
9
|
-
Readout
|
|
10
|
-
</legend>
|
|
11
|
-
<table
|
|
12
|
-
style="border-spacing: 0px; width: 100%;"
|
|
13
|
-
>
|
|
14
|
-
<tbody>
|
|
15
|
-
<tr>
|
|
16
|
-
<td
|
|
17
|
-
style="color: black; font-size: small;"
|
|
18
|
-
>
|
|
19
|
-
⬤
|
|
20
|
-
</td>
|
|
21
|
-
<td>
|
|
22
|
-
DVER
|
|
23
|
-
</td>
|
|
24
|
-
<td
|
|
25
|
-
style="width: 90px; padding-left: 1.5em; text-align: right;"
|
|
26
|
-
>
|
|
27
|
-
2366
|
|
28
|
-
</td>
|
|
29
|
-
<td
|
|
30
|
-
style="padding-left: 0.5em;"
|
|
31
|
-
>
|
|
32
|
-
M
|
|
33
|
-
</td>
|
|
34
|
-
</tr>
|
|
35
|
-
<tr>
|
|
36
|
-
<td
|
|
37
|
-
colspan="4"
|
|
38
|
-
>
|
|
39
|
-
|
|
40
|
-
<hr />
|
|
41
|
-
</td>
|
|
42
|
-
</tr>
|
|
43
|
-
<tr>
|
|
44
|
-
<td
|
|
45
|
-
style="color: orange; font-size: small;"
|
|
46
|
-
>
|
|
47
|
-
⬤
|
|
48
|
-
</td>
|
|
49
|
-
<td>
|
|
50
|
-
BDIA
|
|
51
|
-
</td>
|
|
52
|
-
<td
|
|
53
|
-
style="width: 90px; padding-left: 1.5em; text-align: right;"
|
|
54
|
-
>
|
|
55
|
-
8.5
|
|
56
|
-
</td>
|
|
57
|
-
<td
|
|
58
|
-
style="padding-left: 0.5em;"
|
|
59
|
-
>
|
|
60
|
-
INCH
|
|
61
|
-
</td>
|
|
62
|
-
</tr>
|
|
63
|
-
</tbody>
|
|
64
|
-
</table>
|
|
65
|
-
</fieldset>
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
exports[`Test Info panel snapshot test when value is infinity 1`] = `
|
|
70
|
-
<div
|
|
71
|
-
style="overflow-y: auto; overflow-x: hidden;"
|
|
72
|
-
>
|
|
73
|
-
<fieldset>
|
|
74
|
-
<legend>
|
|
75
|
-
Readout
|
|
76
|
-
</legend>
|
|
77
|
-
<table
|
|
78
|
-
style="border-spacing: 0px; width: 100%;"
|
|
79
|
-
>
|
|
80
|
-
<tbody>
|
|
81
|
-
<tr>
|
|
82
|
-
<td
|
|
83
|
-
style="color: black; font-size: small;"
|
|
84
|
-
>
|
|
85
|
-
⬤
|
|
86
|
-
</td>
|
|
87
|
-
<td>
|
|
88
|
-
DVER
|
|
89
|
-
</td>
|
|
90
|
-
<td
|
|
91
|
-
style="width: 90px; padding-left: 1.5em; text-align: right;"
|
|
92
|
-
/>
|
|
93
|
-
<td
|
|
94
|
-
style="padding-left: 0.5em;"
|
|
95
|
-
>
|
|
96
|
-
M
|
|
97
|
-
</td>
|
|
98
|
-
</tr>
|
|
99
|
-
</tbody>
|
|
100
|
-
</table>
|
|
101
|
-
</fieldset>
|
|
102
|
-
</div>
|
|
103
|
-
`;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Test Well Log View Component snapshot test 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
class="welllogview"
|
|
6
|
-
style="width: 100%; height: 100%; display: flex; flex-direction: column;"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
style="width: 100%; height: 100%; display: flex; flex-direction: column;"
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class="log-controller"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="overlay"
|
|
16
|
-
style="width: 0px; left: 0px; overflow: hidden;"
|
|
17
|
-
>
|
|
18
|
-
<div
|
|
19
|
-
class="depth"
|
|
20
|
-
style="position: absolute; pointer-events: none; visibility: hidden;"
|
|
21
|
-
/>
|
|
22
|
-
<div
|
|
23
|
-
class="rubber-band"
|
|
24
|
-
style="position: relative; pointer-events: none; height: 9px; width: 100%; visibility: hidden;"
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
style="height: 1px; width: 100%; top: 4.5px; position: relative;"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
<div
|
|
31
|
-
class="pinned"
|
|
32
|
-
style="position: absolute; pointer-events: none; height: 9px; width: 100%; left: 0px; visibility: hidden;"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
style="height: 1px; width: 100%; top: 4.5px; position: absolute;"
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
<div
|
|
40
|
-
class="track"
|
|
41
|
-
style="display: flex; flex: 3;"
|
|
42
|
-
>
|
|
43
|
-
<div
|
|
44
|
-
class="track-container"
|
|
45
|
-
>
|
|
46
|
-
<canvas
|
|
47
|
-
style="position: absolute;"
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
`;
|