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.

ClassMethod (Syntax)Description
CanleyMiniSwatchInitialize()Sets the swatch’s color and links it to the main controller to enable selection and deletion logic.
CanleyMiniSwatchConfirmDelete()Removes the color from the controller’s master list and destroys the swatch UI element.
CanleyMiniSwatchCancelDelete()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 to Initialize() to function correctly.

3 items under this folder.