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

fix: add material parameters to SegmentsProps #1708

Merged
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
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,7 @@ type Props = {
/** Event callback when each frame changes */
onFrame?: Function
/** @deprecated Control when the animation runs*/
play?: boolean
play?: boolean
/** Control when the animation pauses */
pause?: boolean
/** Whether or not the Sprite should flip sides on the x-axis */
Expand Down Expand Up @@ -3234,7 +3234,12 @@ A wrapper around [THREE.LineSegments](https://threejs.org/docs/#api/en/objects/L
##### Prop based:

```jsx
<Segments limit={1000} lineWidth={1.0}>
<Segments
limit={1000}
lineWidth={1.0}
// All THREE.LineMaterial props are valid
{...materialProps}
>
<Segment start={[0, 0, 0]} end={[0, 10, 0]} color="red" />
<Segment start={[0, 0, 0]} end={[0, 10, 10]} color={[1, 0, 1]} />
</Segments>
Expand Down
4 changes: 2 additions & 2 deletions src/core/Segments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as THREE from 'three'
import * as React from 'react'
import mergeRefs from 'react-merge-refs'
import { extend, useFrame, ReactThreeFiber } from '@react-three/fiber'
import { Line2, LineSegmentsGeometry, LineMaterial } from 'three-stdlib'
import { Line2, LineSegmentsGeometry, LineMaterial, LineMaterialParameters } from 'three-stdlib'
import { ForwardRefComponent } from '../helpers/ts-utils'

type SegmentsProps = {
type SegmentsProps = LineMaterialParameters & {
limit?: number
lineWidth?: number
children: React.ReactNode
Expand Down