- Refactor LayersSheet component to support mask editing state and improve layer visibility handling. - Introduce functions to collect mask layer IDs and count display layers excluding masks. - Update BrushControls to include mask view mode options and a Done button for exiting mask editing. - Modify brush session handling to support brush previews when editing masks. - Implement a new BrushPreviewRenderer for rendering brush strokes with visual feedback. - Add document geometry utilities for transforming points and resolving layer bounds. - Ensure proper cleanup of brush preview on pointer leave and other interactions.
12 lines
708 B
TypeScript
12 lines
708 B
TypeScript
import type { InteractionMode } from "@editor/tools";
|
|
import { isPanInteractionMode } from "@editor/tools";
|
|
import type { CanvasInputState } from "./useCanvasInput";
|
|
|
|
export function canvasCursorClass(interactionMode: InteractionMode, input: CanvasInputState, hasBrushPreview = false) {
|
|
if (input.isPanning) return "cursor-grabbing";
|
|
if (isPanInteractionMode(interactionMode)) return "cursor-grab";
|
|
if (interactionMode.type === "tool" && (interactionMode.tool === "brush" || interactionMode.tool === "eraser")) return hasBrushPreview ? "cursor-none" : "cursor-crosshair";
|
|
if (interactionMode.type === "tool" && interactionMode.tool === "crop") return "cursor-crosshair";
|
|
return "cursor-default";
|
|
}
|