Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): add pan cursor and background handlers to annotations

Richie McIlroyd95ec970665b
diff --git a/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx b/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx
index 604a8edf2..1a13181a9 100644
--- a/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx
@@ -20,6 +20,8 @@ export function AnnotationLayer(props: {
cssWidth: number;
cssHeight: number;
imageRect: { x: number; y: number; width: number; height: number };
+ isPanning?: boolean;
+ onBackgroundMouseDown?: (e: MouseEvent) => void;
}) {
const {
project,
@@ -166,6 +168,7 @@ export function AnnotationLayer(props: {
if (tool === "select") {
if (e.target === e.currentTarget) {
setSelectedAnnotationId(null);
+ props.onBackgroundMouseDown?.(e);
}
return;
}
@@ -541,6 +544,12 @@ export function AnnotationLayer(props: {
left: 0,
"pointer-events": "all",
"z-index": 10,
+ cursor:
+ activeTool() === "select"
+ ? props.isPanning
+ ? "grabbing"
+ : "grab"
+ : undefined,
}}
class={activeTool() !== "select" ? "cursor-crosshair" : ""}
onMouseDown={handleMouseDown}