ColorPickerHSBSpectrumView

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

A vertical hue spectrum selector for HSB color space.

This view displays a vertical gradient showing the full color spectrum from 0° to 360° (red to red through the rainbow). Users can select a hue by clicking or dragging along the spectrum.

Features:

  • Smooth gradient mesh with configurable precision
  • Interactive pointer with black/white borders for visibility
  • Vertical layout (top = 360°/0° red, bottom = 0°/360° red)
  • Observable pointer movement state

The spectrum is rendered as a mesh with multiple colored segments for smooth color transitions. The precision can be adjusted via the PRECISION constant.

Instance Members

elements
observedDirty: Bool

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


elements
movingPointer: Bool

Whether the pointer is currently being moved. Observable property for coordinating with other components.


elements
hue: Float

The current hue value (0-360 degrees). Setting this updates the pointer position.


elements
invalidateMovingPointer(): Void

elements
new(): Void

Creates a new HSB spectrum view.

Initializes:

  • Gradient mesh with color spectrum
  • Horizontal pointer with contrasting borders
  • Pointer event handlers

Private Members

elements
PRECISION: Int

Number of color segments in the spectrum gradient. Higher values create smoother gradients.


elements
unobservedMovingPointer: Bool

elements
spectrum: ceramic.Mesh

The mesh displaying the color spectrum gradient.


elements
huePointer: ceramic.Border

The horizontal line pointer indicating the selected hue.


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

Event when any observable value as changed on this instance.

Name Type
instance ColorPickerHSBSpectrumView
fromSerializedField Bool

elements
emitUpdateHueFromPointer(): Void

Event emitted when the hue is updated via pointer interaction.


elements
emitMovingPointerChange(current: Bool, previous: Bool): Void

Event when movingPointer field changes.

Name Type
current Bool
previous Bool

elements
initSpectrum(): Void

Initializes the spectrum gradient mesh. Creates a vertical gradient with segments for each hue value, distributed according to the PRECISION constant.


elements
updatePointerFromHue(): Void

Updates the pointer position based on the current hue value. The pointer moves vertically with 0° at the bottom and 360° at the top.


elements
layout(): Void

Lays out the spectrum and pointer to fit the view dimensions.


elements
colorWithHue(hue: Float): ceramic.AlphaColor

Creates a color with maximum saturation and brightness for the given hue.

Name Type Description
hue Float The hue value in degrees (0-360)
Returns Description
ceramic.AlphaColor An AlphaColor with the specified hue at full saturation/brightness

elements
handlePointerDown(info: ceramic.TouchInfo): Void
Name Type
info ceramic.TouchInfo

elements
handlePointerMove(info: ceramic.TouchInfo): Void
Name Type
info ceramic.TouchInfo

elements
handlePointerUp(info: ceramic.TouchInfo): Void
Name Type
info ceramic.TouchInfo

elements
updateHueFromTouchInfo(info: ceramic.TouchInfo): Void

Updates the hue based on touch/pointer position. Calculates the hue from the Y coordinate (inverted so top = 360°).

Name Type Description
info ceramic.TouchInfo Touch information containing pointer coordinates

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()