Skip to content

Commit

Permalink
fix(viewer): rename element to annotation of AnnotationViewer Component
Browse files Browse the repository at this point in the history
  • Loading branch information
LTakhyunKim committed Feb 21, 2023
1 parent 3e1fed0 commit 6398992
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface AnnotationsViewerProps {

export interface AnnotationViewerProps
extends Omit<AnnotationsViewerProps, 'width' | 'height' | 'selectedAnnotation' | 'annotations'> {
element: Annotation
annotation: Annotation
showOutline: boolean
showElementLabel: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const annotationStyle: React.CSSProperties = {
pointerEvents: 'auto',
}
function AnnotationViewer({
element,
annotation,
showOutline,
showElementLabel,
hoveredAnnotation,
Expand All @@ -29,7 +29,7 @@ function AnnotationViewer({
const viewerProps = {
showOutline,
showLabel: showElementLabel,
isHovered: hoveredAnnotation?.id === element.id,
isHovered: hoveredAnnotation?.id === annotation.id,
}

const handleAnnotationClick = () => {
Expand All @@ -39,12 +39,12 @@ function AnnotationViewer({
onFocus(null)
}

onClick(element)
onClick(annotation)
}

const handleAnnotationFocus = () => {
if (!onFocus) return
onFocus(element)
onFocus(annotation)
}

const handleAnnotationFocusOut = () => {
Expand All @@ -53,14 +53,14 @@ function AnnotationViewer({
}

const { drawableAnnotation } = useCreatingDrawableAnnotation({
annotation: element,
annotation: annotation,
pixelToCanvas,
})

return (
<g
data-cy-id={element.id}
key={element.id}
data-cy-id={annotation.id}
key={annotation.id}
onClick={handleAnnotationClick}
onMouseOver={handleAnnotationFocus}
onMouseLeave={handleAnnotationFocusOut}
Expand Down Expand Up @@ -113,7 +113,7 @@ export function AnnotationsViewer({
<AnnotationViewer
key={annotation.id}
showElementLabel={showElementLabel}
element={annotation}
annotation={annotation}
showOutline={showOutline}
hoveredAnnotation={hoveredAnnotation}
onFocus={onFocus}
Expand Down

0 comments on commit 6398992

Please sign in to comment.