- Enhanced cursor behavior for new tools: semantic select, mask lasso, and mask rectangle. - Updated mask edit state to include mask asset ID and kind. - Implemented inpaint region commands for adding, applying, and removing inpaint regions. - Introduced new operations for lasso and semantic selection tools. - Created UI components for candidate review and inpaint region management. - Added tests for inpaint region commands to ensure functionality. - Updated various components to support new inpaint features and improve user experience.
14 lines
918 B
TypeScript
14 lines
918 B
TypeScript
import type { InteractionMode } from "@editor/tools";
|
|
import { isPanInteractionMode } from "@editor/tools";
|
|
export function canvasCursorClass(interactionMode: InteractionMode, isPanning: boolean, hasBrushPreview = false, canBrush = true, operationOpen = false) {
|
|
if (operationOpen) return "cursor-default";
|
|
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" || interactionMode.tool === "semanticSelect" || interactionMode.tool === "maskLasso" || interactionMode.tool === "maskRectangle")) return "cursor-crosshair";
|
|
return "cursor-default";
|
|
}
|