Dim non-highlighted bboxes in Verify mode for visual consistency

Apply the same dimming strategy used in Prepare mode: when an element
is highlighted, reduce stroke and fill opacity of all other bboxes
so the focused element stands out clearly.
This commit is contained in:
Pier-Jean Malandrino 2026-04-02 16:16:34 +02:00
parent 1ff8c5108f
commit 1ed9552224

View file

@ -118,6 +118,7 @@ function draw(): void {
const scale = computeScale(img.clientWidth, img.clientHeight, props.pageData.width, props.pageData.height)
const hasHighlight = props.highlightedIndex >= 0
const hasChunkHighlight = props.highlightedBboxes.length > 0
for (const el of visibleElements.value) {
@ -125,10 +126,8 @@ function draw(): void {
const color = ELEMENT_COLORS[el.type] || ELEMENT_COLORS.text
const elContentIdx = contentElements.value.indexOf(el)
const isHighlighted = props.highlightedIndex >= 0 && elContentIdx === props.highlightedIndex
// Dim non-highlighted elements when a chunk is hovered
const dimmed = hasChunkHighlight && !isHighlighted
const isHighlighted = hasHighlight && elContentIdx === props.highlightedIndex
const dimmed = (hasHighlight || hasChunkHighlight) && !isHighlighted
ctx.strokeStyle = dimmed ? color + '40' : color
ctx.lineWidth = isHighlighted ? 3 : 2