CanleyMiniSwatch
Namespace: Canley.Utility.ColourPicker
Base Class: MonoBehaviour, IPointerClickHandler
Overview
The CanleyMiniSwatch represents an individual saved color entry within the palette. It handles user interaction for selecting colors, as well as the specialized UI logic for confirming and performing deletions.
It is designed to be highly responsive, supporting right-click menus on PC and long-press detection for mobile workflows.
Method Reference
Detailed documentation for each method can be found in the CanleyMiniSwatch subfolder.
| Class | Method (Syntax) | Description |
|---|---|---|
| CanleyMiniSwatch | Initialize() | Sets the swatch’s color and links it to the main controller to enable selection and deletion logic. |
| CanleyMiniSwatch | ConfirmDelete() | Removes the color from the controller’s master list and destroys the swatch UI element. |
| CanleyMiniSwatch | CancelDelete() | Hides the “Are you sure?” delete confirmation overlay and returns the swatch to its normal state. |
Key Features
- Alpha Support: Automatically manages checkerboard backgrounds to ensure transparent colors remain visible against the UI.
- Smart Deletion: Utilizes a full-screen “Outside Click Blocker” when the delete overlay is active, ensuring a clean user experience when dismissing the menu.
- Input Agnostic: Uses Unity’s Event System to handle Pointer events, making it compatible with Mouse, Touch, and Controller-emulated input.
NOTE
Swatches are typically instantiated automatically by the
CanleyColourController. Manual instantiation is possible but requires a call toInitialize()to function correctly.