Perf: memoize AggregateKeyframeEditor
This commit is contained in:
parent
b37ccb1e4e
commit
558882ff0a
1 changed files with 19 additions and 21 deletions
|
@ -60,26 +60,24 @@ export type IAggregateKeyframeEditorProps = {
|
|||
* is open. This would require having some kind of stable identity for each aggregate row.
|
||||
* Let's defer that work until other interactive keyframe editing PRs are merged in.
|
||||
*/
|
||||
const AggregateKeyframeEditor: React.VFC<IAggregateKeyframeEditorProps> = (
|
||||
props,
|
||||
) => {
|
||||
const utils = useAggregateKeyframeEditorUtils(props)
|
||||
|
||||
return (
|
||||
<AggregateKeyframeEditorContainer
|
||||
style={{
|
||||
top: `${props.viewModel.nodeHeight / 2}px`,
|
||||
left: `calc(${val(
|
||||
props.layoutP.scaledSpace.leftPadding,
|
||||
)}px + calc(var(--unitSpaceToScaledSpaceMultiplier) * ${
|
||||
utils.cur.position
|
||||
}px))`,
|
||||
}}
|
||||
>
|
||||
<AggregateKeyframeDot editorProps={props} utils={utils} />
|
||||
<AggregateKeyframeConnector editorProps={props} utils={utils} />
|
||||
</AggregateKeyframeEditorContainer>
|
||||
)
|
||||
}
|
||||
const AggregateKeyframeEditor: React.VFC<IAggregateKeyframeEditorProps> =
|
||||
React.memo((props) => {
|
||||
const utils = useAggregateKeyframeEditorUtils(props)
|
||||
return (
|
||||
<AggregateKeyframeEditorContainer
|
||||
style={{
|
||||
top: `${props.viewModel.nodeHeight / 2}px`,
|
||||
left: `calc(${val(
|
||||
props.layoutP.scaledSpace.leftPadding,
|
||||
)}px + calc(var(--unitSpaceToScaledSpaceMultiplier) * ${
|
||||
utils.cur.position
|
||||
}px))`,
|
||||
}}
|
||||
>
|
||||
<AggregateKeyframeDot editorProps={props} utils={utils} />
|
||||
<AggregateKeyframeConnector editorProps={props} utils={utils} />
|
||||
</AggregateKeyframeEditorContainer>
|
||||
)
|
||||
})
|
||||
|
||||
export default AggregateKeyframeEditor
|
||||
|
|
Loading…
Reference in a new issue