Skip to content
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

refactor: add option to set default shader material to transparent in… #2217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/misc/html.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Allows you to tie HTML content to any object of your scene. It will be projected
calculatePosition={(el: Object3D, camera: Camera, size: { width: number; height: number }) => number[]} // Override default positioning function. (default=undefined) [ignored in transform mode]
occlude={[ref]} // Can be true or a Ref<Object3D>[], true occludes the entire scene (default: undefined)
onOcclude={(hidden) => null} // Callback when the visibility changes (default: undefined)
transparent // sets the default shader material to transparent (default:false)
{...groupProps} // All THREE.Group props are valid
{...divProps} // All HTMLDivElement props are valid
>
Expand Down
3 changes: 3 additions & 0 deletions src/web/Html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export interface HtmlProps
distanceFactor?: number
sprite?: boolean
transform?: boolean
transparent?: boolean
zIndexRange?: Array<number>
calculatePosition?: CalculatePosition
as?: string
Expand Down Expand Up @@ -168,6 +169,7 @@ export const Html: ForwardRefComponent<HtmlProps, HTMLDivElement> = /* @__PURE__
calculatePosition = defaultCalculatePosition,
as = 'div',
wrapperClass,
transparent=false,
pointerEvents = 'auto',
...props
}: HtmlProps,
Expand Down Expand Up @@ -459,6 +461,7 @@ export const Html: ForwardRefComponent<HtmlProps, HTMLDivElement> = /* @__PURE__
{material || (
<shaderMaterial
side={DoubleSide}
transparent={transparent}
vertexShader={shaders.vertexShader}
fragmentShader={shaders.fragmentShader}
/>
Expand Down