equinor / videx-wellog

Well log components
https://equinor.github.io/videx-wellog/
MIT License
20 stars 7 forks source link

[BUG] track content width sometimes does not fit track width #214

Closed mirisb closed 2 months ago

mirisb commented 8 months ago

Description When resizing stacked track within a log viewer component the rendered stacked log sometimes doesn't fit the width of the track, and is either 1-2 pixel less or 1 pixel extra than the width.

Steps required to recreate issue I recreated this on videx well log by adding two stacked logs to the tracks given to the Wellog Component story:

  1. Edit examples\plain-javascript-example\src\shared\tracks.js (I suggest to make this modification permanent in this story to show stacked logs in combination with graph logs).
  2. Add import to StackedTrack
  3. Add imports to example data ex4 and ex6
  4. Add the following lines after the track for "Pointy"
    new StackedTrack('stacked1', {
      data: ex4,    }),
    new StackedTrack('stacked2', {
      data: ex6,
    }),
  5. Run storybook and changed story, then change the width of the component to resize the tracks.
  6. Notice also that stacked tracks are not visible before initial resize)

Expected behavior

  1. Stacked logs should always perfectly fit track width
  2. Stacked tracks in modified wellog.component.story.js in storybook should be visible upon initial mount (If it is a matter of how I built the track, then please comment how it should be done to avoid this problem)

Screenshots The problem with log width more than track width: image The problem with log width less than track width: image

Desktop (please complete the following information):

olems commented 7 months ago

Thanks for reporting this. We did some package updates recently to use the wellog with node 20 and we've noticed some side effects, the issue with tracks needing a refresh to become visible is possibly one of those, We've noticed the same when doing hot reload. A workaround for now is to add a logViewer.reset() between the init() and setTracks().

The storybook examples need a bigger update in general to work with newer packages, the storybook version used now is very old. Adding the stracked tracks to the example can of course be done.

The stacked track width issue is probably a math error in the plot code, it seems to only happen for certain widths. Will add a card for this in our backlog.

VRiveland commented 2 months ago

The easiest way to test this is to open the well-log in full screen, open the inspect tool and then change the width of the inspect tool.

VRiveland commented 2 months ago

@mirisb This has been (at least mostly) fixed now. There might still be some issues with the width, but the issues remaining would need a huge rewrite to fix, so we hope that this smaller fix is sufficient.

mirisb commented 2 months ago

@VRiveland Thank you. This is a minor bug yet very annoying. I hope this fix will be enough.