-
Notifications
You must be signed in to change notification settings - Fork 42
fix: [NGRM] When zoomed in text labels on 3D axes shrinks. #2510 #2511
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ad9c966
fix: [NGRM] When zoomed in text labels on 3D axes shrinks. #2510
nilscb fba2e3b
Merge branch 'master' into LabelSizeIssue
nilscb 134646f
smoke
nilscb 1b5e547
Merge remote-tracking branch 'origin/LabelSizeIssue' into LabelSizeIssue
nilscb 15295de
smoke
nilscb 078abb3
smoke
nilscb 2437341
fix: [NGRM] When zoomed in text labels on 3D axes shrinks. #2510
nilscb 425a5f8
smoke
nilscb 4da0bc7
smoke
nilscb daaa8fa
smoke
nilscb 4298606
A factor of 1 seems to work better. Also added the extension to Wells…
nilscb 0ee3c17
Merge remote-tracking branch 'origin/LabelSizeIssue' into LabelSizeIssue
nilscb 200aa06
Merge branch 'master' into LabelSizeIssue
nilscb bedce9a
Merge branch 'master' of github.com:equinor/webviz-subsurface-compone…
hkfb 9ac23ee
docs: add docs and update story snapshots
hkfb 516c04f
test: update failing story snapshots
hkfb 1184d11
Merge branch 'master' of github.com:equinor/webviz-subsurface-compone…
hkfb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
typescript/packages/subsurface-viewer/src/extensions/fixed-size-extension.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { LayerExtension } from "@deck.gl/core"; | ||
|
||
/** | ||
* The `FixedSizeExtension` class is a custom Deck.gl layer extension that modifies the size of rendered objects | ||
* based on their clip-space position. This extension can be used to ensure that objects maintain a fixed size | ||
* relative to the viewport, regardless of their depth in the scene. | ||
* | ||
* @extends LayerExtension | ||
* | ||
* @remarks | ||
* The `getShaders` method injects a custom shader snippet into the vertex shader stage of Deck.gl's rendering pipeline. | ||
* Specifically, it modifies the `size` variable by scaling it with `gl_Position.w`, which represents the depth | ||
* component in clip space. | ||
* | ||
* @example | ||
* ```typescript | ||
* import { FixedSizeExtension } from './fixed-size-extension'; | ||
* import { TextLayer } from '@deck.gl/layers'; | ||
* | ||
* const layer = new TextLayer({ | ||
* data, | ||
* getPosition: d => d.coordinates, | ||
* getText: d => d.label, | ||
* getSize: d => d.size, | ||
* extensions: [new FixedSizeExtension()], | ||
* }); | ||
* ``` | ||
* @note See this discussion for more details: https://github.com/visgl/deck.gl/issues/7992 | ||
*/ | ||
export class FixedSizeExtension extends LayerExtension { | ||
getShaders() { | ||
return { | ||
inject: { | ||
"vs:DECKGL_FILTER_SIZE": "size *= gl_Position.w;", | ||
}, | ||
}; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.22 KB
(100%)
...ples/__image_snapshots__/subsurfaceviewer-examples--mixed-layer-definitions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-858 Bytes
(99%)
...ok/examples/__image_snapshots__/subsurfaceviewer-examples-camera--add-layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.95 KB
(79%)
..._image_snapshots__/subsurfaceviewer-examples-camera--auto-zoom-to-box-story.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.09 KB
(99%)
...s/__image_snapshots__/subsurfaceviewer-examples-camera--rotate-camera-story.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-17.2 KB
(77%)
...les/__image_snapshots__/subsurfaceviewer-examples-camera--scale-factor-hook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-20.4 KB
(78%)
...es/__image_snapshots__/subsurfaceviewer-examples-camera--scale-vertical-3-d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.54 KB
(100%)
...book/examples/__image_snapshots__/subsurfaceviewer-examples-camera--scale-z.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.93 KB
(100%)
...mples/__image_snapshots__/subsurfaceviewer-examples-rendering--lights-story.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-509 Bytes
(99%)
...ers/__image_snapshots__/subsurfaceviewer-axes2dlayer--format-label-function.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+362 Bytes
(100%)
...orybook/layers/__image_snapshots__/subsurfaceviewer-axeslayer--custom-label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.12 KB
(90%)
.../storybook/layers/__image_snapshots__/subsurfaceviewer-axeslayer--dark-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.23 KB
(90%)
...storybook/layers/__image_snapshots__/subsurfaceviewer-axeslayer--light-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.09 KB
(120%)
.../subsurfaceviewer-experimental-intersection-view--with-sample-polyline-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8.96 KB
(140%)
...napshots__/subsurfaceviewer-experimental-intersection-view--with-wells-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+28 Bytes
(100%)
...yers/__image_snapshots__/subsurfaceviewer-grid3d-layer--continuous-property.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.65 KB
(110%)
..._snapshots__/subsurfaceviewer-grid3d-layer--discrete-property-with-clamping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.86 KB
(120%)
...bsurfaceviewer-grid3d-layer--discrete-property-with-color-func-and-clamping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.55 KB
(110%)
...ts__/subsurfaceviewer-grid3d-layer--discrete-property-with-undefined-values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+47 Bytes
(100%)
...layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--discrete-property.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.3 KB
(100%)
.../layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--polyhedral-cells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.41 KB
(100%)
...ybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-2-x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.33 KB
(100%)
...ybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-4-x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.08 KB
(100%)
...yers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-8-x-i-jonly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.33 KB
(100%)
...storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.9 KB
(110%)
...rybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--z-painting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.58 KB
(100%)
...torybook/layers/__image_snapshots__/subsurfaceviewer-map-layer--big-map-3-d.png
Oops, something went wrong.
Binary file modified
BIN
-627 Bytes
(100%)
...rc/storybook/layers/__image_snapshots__/subsurfaceviewer-map-layer--big-map.png
Oops, something went wrong.
Binary file modified
BIN
+1.7 KB
(110%)
...yers/__image_snapshots__/subsurfaceviewer-map-layer--cell-centered-prop-map.png
Oops, something went wrong.
Binary file modified
BIN
+6.18 KB
(130%)
...storybook/layers/__image_snapshots__/subsurfaceviewer-map-layer--extensions.png
Oops, something went wrong.
Binary file modified
BIN
-721 Bytes
(100%)
...ers/__image_snapshots__/subsurfaceviewer-map-layer--map-layer-2-d-dark-mode.png
Oops, something went wrong.
Binary file modified
BIN
+2.53 KB
(100%)
...__image_snapshots__/subsurfaceviewer-map-layer--map-layer-3-d-png-no-bounds.png
Oops, something went wrong.
Binary file modified
BIN
+5.52 KB
(100%)
...ok/layers/__image_snapshots__/subsurfaceviewer-map-layer--map-layer-3-d-png.png
Oops, something went wrong.
Binary file modified
BIN
+4.24 KB
(120%)
...k/layers/__image_snapshots__/subsurfaceviewer-map-layer--map-with-artefacts.png
Oops, something went wrong.
Binary file modified
BIN
+9.07 KB
(120%)
...yers/__image_snapshots__/subsurfaceviewer-map-layer--node-centered-prop-map.png
Oops, something went wrong.
Binary file modified
BIN
-457 Bytes
(100%)
...rc/storybook/layers/__image_snapshots__/subsurfaceviewer-map-layer--rotated.png
Oops, something went wrong.
Binary file modified
BIN
+7.55 KB
(110%)
.../storybook/layers/__image_snapshots__/subsurfaceviewer-map-layer--small-map.png
Oops, something went wrong.
Binary file modified
BIN
+649 Bytes
(100%)
...ok/layers/__image_snapshots__/subsurfaceviewer-map-layer--typed-array-input.png
Oops, something went wrong.
Binary file modified
BIN
+5.54 KB
(100%)
...ers/__image_snapshots__/subsurfaceviewer-map-layer-colormap--constant-color.png
Oops, something went wrong.
Binary file modified
BIN
-419 Bytes
(99%)
...rybook/layers/__image_snapshots__/subsurfaceviewer-mergedtextlayer--default.png
Oops, something went wrong.
Binary file modified
BIN
-503 Bytes
(98%)
...k/layers/__image_snapshots__/subsurfaceviewer-mergedtextlayer--merge-radius.png
Oops, something went wrong.
Binary file modified
BIN
-801 Bytes
(95%)
...e_snapshots__/subsurfaceviewer-north-arrow-layer--north-arrow-2-d-dark-mode.png
Oops, something went wrong.
Binary file modified
BIN
+6.18 KB
(130%)
...ers/__image_snapshots__/subsurfaceviewer-north-arrow-layer--north-arrow-3-d.png
Oops, something went wrong.
Binary file modified
BIN
+916 Bytes
(110%)
...shots__/subsurfaceviewer-points-layer--small-points-layer-typed-array-input.png
Oops, something went wrong.
Binary file modified
BIN
+915 Bytes
(110%)
...ayers/__image_snapshots__/subsurfaceviewer-points-layer--small-points-layer.png
Oops, something went wrong.
Binary file modified
BIN
+2.96 KB
(120%)
...__image_snapshots__/subsurfaceviewer-polylines-layer--small-polylines-layer.png
Oops, something went wrong.
Binary file modified
BIN
+4.17 KB
(110%)
...s/__image_snapshots__/subsurfaceviewer-triangle-layer--small-triangle-layer.png
Oops, something went wrong.
Binary file modified
BIN
+5.33 KB
(100%)
...yers/__image_snapshots__/subsurfaceviewer-triangle-layer--two-side-lighting.png
Oops, something went wrong.
Binary file modified
BIN
+7.25 KB
(100%)
...yers/__image_snapshots__/subsurfaceviewer-triangle-layer--typed-array-input.png
Oops, something went wrong.
Binary file modified
BIN
-708 Bytes
(97%)
...ybook/layers/__image_snapshots__/subsurfaceviewer-well-label-layer--default.png
Oops, something went wrong.
Binary file modified
BIN
-711 Bytes
(97%)
.../__image_snapshots__/subsurfaceviewer-well-label-layer--label-auto-position.png
Oops, something went wrong.
Binary file modified
BIN
-97 Bytes
(100%)
...ayers/__image_snapshots__/subsurfaceviewer-well-label-layer--label-position.png
Oops, something went wrong.
Binary file modified
BIN
-517 Bytes
(98%)
...k/layers/__image_snapshots__/subsurfaceviewer-well-label-layer--label-style.png
Oops, something went wrong.
Binary file modified
BIN
-336 Bytes
(99%)
..._image_snapshots__/subsurfaceviewer-well-label-layer--sparse-label-position.png
Oops, something went wrong.
Binary file modified
BIN
-456 Bytes
(98%)
.../__image_snapshots__/subsurfaceviewer-well-label-layer--tangent-orientation.png
Oops, something went wrong.
Binary file modified
BIN
+2.95 KB
(100%)
...ayers/__image_snapshots__/subsurfaceviewer-well-markers-layer--well-markers.png
Oops, something went wrong.
Binary file modified
BIN
-914 Bytes
(99%)
...layers/__image_snapshots__/subsurfaceviewer-wells-layer--coarse-well-factor.png
Oops, something went wrong.
Binary file modified
BIN
+7.38 KB
(100%)
...yers/__image_snapshots__/subsurfaceviewer-wells-layer--simplified-rendering.png
Oops, something went wrong.
Binary file modified
BIN
+6.63 KB
(140%)
...age_snapshots__/subsurfaceviewer-wells-layer--vertical-well-with-duplicates.png
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.