-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: live update the tree during edition
close #1079
- Loading branch information
1 parent
9264f01
commit 2886523
Showing
17 changed files
with
335 additions
and
211 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/component/1d/multiplicityTree/TempMultiplicityTree.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,22 @@ | ||
import { memo } from 'react'; | ||
|
||
import TempRangeWrapper from '../../hoc/TempRangeWrapper'; | ||
|
||
import MultiplicityTree from './MultiplicityTree'; | ||
|
||
function TempMultiplicityTree({ range }) { | ||
return ( | ||
range?.signal && | ||
range.signal.length > 0 && | ||
range.signal.map((signal) => ( | ||
<MultiplicityTree | ||
rangeFrom={range.from} | ||
rangeTo={range.to} | ||
signal={signal} | ||
key={signal.id} | ||
/> | ||
)) | ||
); | ||
} | ||
|
||
export default TempRangeWrapper(memo(TempMultiplicityTree)); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { memo, forwardRef } from 'react'; | ||
|
||
import { useChartData } from '../context/ChartContext'; | ||
|
||
export default function TempRangeWrapper(WrappedComponent) { | ||
function Wrapper(props) { | ||
const { | ||
toolOptions: { | ||
data: { tempRange }, | ||
}, | ||
} = useChartData(); | ||
|
||
const { forwardedRef, ...rest } = props; | ||
return <WrappedComponent {...rest} range={tempRange} ref={forwardedRef} />; | ||
} | ||
|
||
return memo( | ||
forwardRef((props, ref) => { | ||
return <Wrapper {...props} forwardedRef={ref} />; | ||
}), | ||
); | ||
} |
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
Oops, something went wrong.