13 lines
718 B
TypeScript
13 lines
718 B
TypeScript
import type { InteractionMode } from "@editor/tools";
|
|
import { isPanInteractionMode } from "@editor/tools";
|
|
export function canvasCursorClass(interactionMode: InteractionMode, isPanning: boolean, hasBrushPreview = false, canBrush = true) {
|
|
if (isPanning) return "cursor-grabbing";
|
|
if (isPanInteractionMode(interactionMode)) return "cursor-grab";
|
|
if (interactionMode.type === "tool" && (interactionMode.tool === "brush" || interactionMode.tool === "eraser")) {
|
|
if (!canBrush) return "cursor-not-allowed";
|
|
return hasBrushPreview ? "cursor-none" : "cursor-crosshair";
|
|
}
|
|
if (interactionMode.type === "tool" && interactionMode.tool === "magicWand") return "cursor-crosshair";
|
|
return "cursor-default";
|
|
}
|