Skip to content

Commit 10bca0b

Browse files
authored
Merge pull request #513 from torioLuz/bugfix/issue-495
fix the annotation object merge
2 parents 874bda5 + 1f08577 commit 10bca0b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/components/AnnotationLayer.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,13 @@ class AnnotationLayer extends React.Component<
429429
)
430430
} else {
431431
//Handle when style or other attributes change
432-
adjustedAnnotations = adjustedAnnotations.map((d: NoteType, i) => {
433-
const newNoteData = Object.assign(
434-
adjustableAnnotations[i].props.noteData,
435-
{
436-
nx: d.props.noteData.nx,
437-
ny: d.props.noteData.ny,
438-
note: d.props.noteData.note
439-
}
440-
)
432+
adjustedAnnotations = adjustableAnnotations.map((d: NoteType, i) => {
433+
const oldAnnotation = adjustedAnnotations[i] as NoteType
434+
const newNoteData = {
435+
...oldAnnotation.props.noteData,
436+
...d.props.noteData
437+
}
438+
441439
return <Annotation key={d.key} noteData={newNoteData} />
442440
})
443441
}

0 commit comments

Comments
 (0)