ColorPickerPaletteColorView

ceramic.Entityceramic.Visualceramic.Quadceramic.Layerceramic.Viewelements.ColorPickerPaletteColorView (Class)
Implements: tracker.Observable

A single color swatch in a color picker palette. This view represents an individual color that can be selected, dragged, and dropped within a color palette interface.

Features:

  • Click to select the color
  • Long press for additional actions (e.g., delete, edit)
  • Drag and drop to reorder colors in the palette
  • Visual feedback for press and drag states

The view maintains a square aspect ratio and provides transform-based visual feedback when pressed or dragged.

@event click Emitted when the color is clicked @event drop Emitted when the color is dropped after dragging @event longPress Emitted when the color is long-pressed

Instance Members

elements
observedDirty: Bool

Default is false, automatically set to true when any of this instance's observable variables has changed.


elements
dragDrop: DragDrop

Drag and drop component for palette reordering


elements
dragging: Bool

Whether this color swatch is currently being dragged


elements
colorValue: ceramic.Color

The color value represented by this swatch. Setting this updates the visual appearance.


elements
new(?colorValue: ceramic.Color = Color.WHITE): Void

Creates a new palette color swatch.

Name Type Default Description
colorValue ceramic.Color Color.WHITE The color to display (default: white)

Private Members

elements
PALETTE_COLOR_SIZE: Float

Standard size for palette color swatches in pixels


elements
click: ceramic.Click

Click detection component for color selection


elements
longPress: ceramic.LongPress

Long press detection for context actions


elements
emitObservedDirty(instance: ColorPickerPaletteColorView, fromSerializedField: Bool): Void

Event when any observable value as changed on this instance.

Name Type
instance ColorPickerPaletteColorView
fromSerializedField Bool

elements
emitClick(instance: ColorPickerPaletteColorView): Void

click event

Name Type
instance ColorPickerPaletteColorView

elements
emitDrop(instance: ColorPickerPaletteColorView): Void

drop event

Name Type
instance ColorPickerPaletteColorView

elements
emitLongPress(instance: ColorPickerPaletteColorView, info: ceramic.TouchInfo): Void

longPress event

Name Type
instance ColorPickerPaletteColorView
info ceramic.TouchInfo

elements
updateStyle(): Void

Updates the visual transform based on interaction state.

  • Dragging: follows drag position
  • Pressed: slight downward offset
  • Normal: no offset

elements
bindDraggingDepth(): Void

Ensures dragged colors appear above other elements. Temporarily increases depth during drag operations.


elements
getDraggingVisual(): ColorPickerPaletteColorView

Provides the visual to be dragged (the swatch itself).

Returns Description
ColorPickerPaletteColorView This color swatch view

elements
releaseDraggingVisual(visual: ceramic.Visual): Void

Called when drag operation ends. No cleanup needed as the swatch drags itself.

Name Type Description
visual ceramic.Visual The visual that was dragged

elements
handleDraggingChange(dragging: Bool, wasDragging: Bool): Void

Handles drag state changes and emits drop event when dragging ends.

Name Type Description
dragging Bool Current dragging state
wasDragging Bool Previous dragging state

elements
toString(): String

Returns a string representation of this color swatch.

Returns Description
String String in format "ColorPickerPaletteColorView(#RRGGBB)"

Metadata

Name Parameters
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()