Skip to content

Commit

Permalink
Refresh well log track title tooltip after interactive editing (#1641)
Browse files Browse the repository at this point in the history
* fix: workaround of wrong behavior of videx wellog component
* fix: fix crash on edit scale track title


---------

Co-authored-by: Vladimir-Kokin <86053741+Vladimir-Kokin@users.noreply.github.com>
  • Loading branch information
hkfb and Vladimir-Kokin committed Aug 30, 2023
1 parent 7998ba5 commit 8c8d17f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,17 @@ class WellLogView
return this.props.horizontal ? 3 : 5 /*some default value*/;
}
}
_forceUpdateTitleTooltips(): void {
// workaround to refresh tooltips in videx wellog component
if (!this.container) return;
const elements = this.container.getElementsByClassName("track-title");
for (const element of elements) {
if (element.textContent)
element.setAttribute("title", element.textContent);
//const title=element.getAttribute("title");
//console.log(title);
}
}

scrollTrackBy(delta: number): void {
this.setState((state: Readonly<State>) => ({
Expand Down Expand Up @@ -1772,7 +1783,15 @@ class WellLogView
}

_editTrack(track: Track, templateTrack: TemplateTrack): void {
if (templateTrack.plots && templateTrack.plots[0].type === "stacked") {
const titleCompare = track.options.label?.localeCompare(
templateTrack.title
);

if (
templateTrack.plots &&
templateTrack.plots[0] &&
templateTrack.plots[0].type === "stacked"
) {
addOrEditStackedTrack(
this,
track as StackedTrack,
Expand All @@ -1789,6 +1808,9 @@ class WellLogView
false
);
}
if (titleCompare)
// workaround to refresh tooltips in videx wellog component
this._forceUpdateTitleTooltips();
this.onTemplateChanged();
}

Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/well-log-viewer/src/utils/tracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ function updateGraphTrackScale(track: GraphTrack): void {
if (!track.options.scale) track.options.scale = "linear";
}

if (track.plots.length) {
if (track.plots?.length) {
const plot = track.plots[0];
track.options.domain = plot.options.domain as Domain;
}
Expand Down

0 comments on commit 8c8d17f

Please sign in to comment.