forked from equinor/webviz-subsurface-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd85ba6
commit 4396a16
Showing
7 changed files
with
237 additions
and
215 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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
29 changes: 29 additions & 0 deletions
29
typescript/packages/subsurface-viewer/src/components/View.tsx
This file contains 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,29 @@ | ||
import { Deck, Viewport, View } from "@deck.gl/core"; | ||
import { DeckGLRef } from "@deck.gl/react"; | ||
import React from "react"; | ||
|
||
export type ViewProps = { | ||
id: string; | ||
deckGlRef: React.RefObject<DeckGLRef | null>; | ||
children?: React.ReactNode; | ||
}; | ||
|
||
export function ViewContent(props: ViewProps): React.ReactNode { | ||
const deckRef = React.useRef<Deck | null>(null); | ||
|
||
React.useEffect( | ||
function onMount() { | ||
if (props.deckGlRef.current) { | ||
deckRef.current = props.deckGlRef.current.deck ?? null; | ||
if (deckRef.current) { | ||
const views = deckRef.current.getViews(); | ||
const view = views.find((v) => v.id === props.id); | ||
if (view) { | ||
deckRef.current.props.onViewStateChange | ||
} | ||
} | ||
} | ||
}, | ||
[props.deckGlRef] | ||
); | ||
} |
This file contains 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
12 changes: 6 additions & 6 deletions
12
typescript/packages/subsurface-viewer/src/hooks/useMultiViewPicking/useMultiViewPicking.ts
This file contains 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