-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: well layer: wellNameAtTop control is inverted #2432 #2433
base: master
Are you sure you want to change the base?
Conversation
nilscb
commented
Feb 3, 2025
- Simplified some code
- Make sure label stays visible when camera changes.
- fix bug "well layer: wellNameAtTop control is inverted well layer: wellNameAtTop control is inverted #2432"
typescript/packages/subsurface-viewer/src/storybook/layers/WellsLayer.stories.tsx
Outdated
Show resolved
Hide resolved
typescript/packages/subsurface-viewer/src/storybook/layers/WellsLayer.stories.tsx
Outdated
Show resolved
Hide resolved
typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts
Outdated
Show resolved
Hide resolved
typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts
Outdated
Show resolved
Hide resolved
const h = this.context.viewport.height; | ||
|
||
const percentages = [50, 25, 75, 12.5, 87.5, 25, 75]; | ||
|
||
const n = well_xyz?.length ?? 2; | ||
if (well_xyz && n >= 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments to explain the algorithm (are a ref to original if it comes from a known algo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I don't get the logic. If I understand correctly, if the algo fail with the provided percentage, a hard-coded list of percentages completely unrelated to the requested one is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wait a bit with this code review. The Wellslayer.stories file is included by mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not related to story, but to wellsLayer.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regular sampling along the trajectory in search of a camera visible location. It is shuffled to minimize large jumps and to tend towards the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What bothers me is that it does absolutely not take into account requested position.
I would use an approach to shift away from the requested position , not to ignore it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What bothers me is that it does absolutely not take into account requested position.
I would use an approach to shift away from the requested position , not to ignore it
I agree, it could be better usability if the labels shifted more gradually from the requested position instead of popping up at a random position.
6af52bb
to
0537835
Compare
The auto positioning of lables is now default off and controlled by the well property "wellNameAutoPosition" |
const h = this.context.viewport.height; | ||
|
||
const percentages = [50, 25, 75, 12.5, 87.5, 25, 75]; | ||
|
||
const n = well_xyz?.length ?? 2; | ||
if (well_xyz && n >= 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not related to story, but to wellsLayer.ts
/** It true label position will be auto calculated if possible to be inside view volume at all times. | ||
* default false. | ||
*/ | ||
wellNameAutoPosition: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename that to adjustWellNamePosition
const h = this.context.viewport.height; | ||
|
||
const percentages = [50, 25, 75, 12.5, 87.5, 25, 75]; | ||
|
||
const n = well_xyz?.length ?? 2; | ||
if (well_xyz && n >= 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What bothers me is that it does absolutely not take into account requested position.
I would use an approach to shift away from the requested position , not to ignore it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also appears that if you provoke a 90 degree angle on the labels by rotating the camera, then the labels disappear.