fix(touch): enable annotation drawing and hover on touch devices
- Add touch-action:none to container when in annotate mode so the browser doesn't intercept touch gestures for scroll/pan - Replace onmouseenter/onmouseleave with onpointerenter/onpointerleave so the highlight effect also fires on touch/stylus Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,7 @@ function handlePointerUp(event: PointerEvent) {
|
|||||||
let hoveredId = $state<string | null>(null);
|
let hoveredId = $state<string | null>(null);
|
||||||
|
|
||||||
const containerStyle = $derived(
|
const containerStyle = $derived(
|
||||||
`position: absolute; top: 0; left: 0; width: 100%; height: 100%;${canAnnotate ? ' cursor: crosshair;' : ''}`
|
`position: absolute; top: 0; left: 0; width: 100%; height: 100%;${canAnnotate ? ' cursor: crosshair; touch-action: none;' : ''}`
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -113,8 +113,8 @@ const containerStyle = $derived(
|
|||||||
aria-label="Kommentare anzeigen"
|
aria-label="Kommentare anzeigen"
|
||||||
onclick={() => onAnnotationClick?.(annotation.id)}
|
onclick={() => onAnnotationClick?.(annotation.id)}
|
||||||
onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') onAnnotationClick?.(annotation.id); }}
|
onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') onAnnotationClick?.(annotation.id); }}
|
||||||
onmouseenter={() => (hoveredId = annotation.id)}
|
onpointerenter={() => (hoveredId = annotation.id)}
|
||||||
onmouseleave={() => (hoveredId = null)}
|
onpointerleave={() => (hoveredId = null)}
|
||||||
style="
|
style="
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: {annotation.x * 100}%;
|
left: {annotation.x * 100}%;
|
||||||
|
|||||||
Reference in New Issue
Block a user