diff --git a/components/work-review/WorkReviewAnnotationMarker.tsx b/components/work-review/WorkReviewAnnotationMarker.tsx index 50d7228..f012cf1 100644 --- a/components/work-review/WorkReviewAnnotationMarker.tsx +++ b/components/work-review/WorkReviewAnnotationMarker.tsx @@ -17,6 +17,17 @@ function markerTone(item: WorkReviewDisplayAnnotation) { return 'bg-[#0050cb] text-white ring-[#dcecff]' } +function markerColor(item: WorkReviewDisplayAnnotation) { + if (item.annotation.color) return item.annotation.color + if (item.draft) return '#8a5200' + if (item.reviewerRole === 'final_reviewer') return '#087a3c' + return '#0050cb' +} + +function commentPosition(x: number) { + return x > 0.62 ? 'right-9' : 'left-9' +} + export function WorkReviewAnnotationMarker({ item, onClick, @@ -27,6 +38,8 @@ export function WorkReviewAnnotationMarker({ showComment?: boolean }) { const { annotation } = item + const shape = annotation.shape || 'point' + const color = markerColor(item) const alignRight = annotation.x > 0.62 const roleLabel = item.draft ? '当前批注' @@ -34,10 +47,92 @@ export function WorkReviewAnnotationMarker({ ? '元泽' : '评审人' const summary = annotation.comment.trim() || '待填写修改意见' - const positionState = item.positionEditable ? ',位置可调整' : '' + const positionState = item.positionEditable + ? shape === 'point' ? ',位置可调整' : ',范围可调整' + : '' const label = `${roleLabel}标注 ${item.markerNumber}${positionState}${item.reviewerName ? `,${item.reviewerName}` : ''}:${summary}` const visualTitle = showComment ? label : `${roleLabel}标注 ${item.markerNumber}` + if (shape !== 'point' && annotation.x2 != null && annotation.y2 != null) { + const minX = Math.min(annotation.x, annotation.x2) + const minY = Math.min(annotation.y, annotation.y2) + const width = Math.max(0.008, Math.abs(annotation.x2 - annotation.x)) + const height = Math.max(0.008, Math.abs(annotation.y2 - annotation.y)) + const arrowPointsRight = annotation.x2 >= annotation.x + const arrowPointsDown = annotation.y2 >= annotation.y + const arrowX1 = arrowPointsRight ? 4 : 96 + const arrowY1 = arrowPointsDown ? 4 : 96 + const arrowX2 = arrowPointsRight ? 96 : 4 + const arrowY2 = arrowPointsDown ? 96 : 4 + const markerId = `work-review-arrow-${annotation.id.replace(/[^a-zA-Z0-9_-]/g, '')}` + const lightColor = color === '#ffffff' + + return ( + + ) + } + return ( + ))} + + +