{#each annotations as annotation (annotation.id)}
onAnnotationClick?.(annotation.id)} onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') onAnnotationClick?.(annotation.id); }} onmouseenter={() => (hoveredId = annotation.id)} onmouseleave={() => (hoveredId = null)} style=" position: absolute; left: {annotation.x * 100}%; top: {annotation.y * 100}%; width: {annotation.width * 100}%; height: {annotation.height * 100}%; background-color: {hexToRgba(annotation.color, hoveredId === annotation.id ? 0.5 : 0.3)}; box-shadow: {hoveredId === annotation.id ? `inset 0 0 0 2px ${hexToRgba(annotation.color, 0.8)}` : 'none'}; pointer-events: auto; transition: background-color 0.15s ease, box-shadow 0.15s ease; {onAnnotationClick && !canAnnotate ? 'cursor: pointer;' : ''} " > {#if canAnnotate} {/if} {#if (commentCounts?.[annotation.id] ?? 0) > 0}
{commentCounts?.[annotation.id]}
{/if}
{/each} {#if drawRect && drawRect.width > 0}
{/if}