API Docs for: 1.7.0
Show:

photonui.ColorPicker Class

Extends photonui.Widget
Module: Interactive
Parent Module: PhotonUI

A Color Picker.

wEvents:

  • value-changed:
    • description: the selected color changed.
    • callback: function(widget, color)

Constructor

photonui.ColorPicker

(
  • params
)

Parameters:

  • params Object

    An object that can contain any property of the widget (optional).

Methods

__onContextMenu

(
  • event
)
private
Called when the context menu should be displayed.

Parameters:

__onDragEnd

(
  • manager
  • mstate
)
private

Parameters:

__onDraggingCircle

(
  • manager
  • mstate
)
private

Parameters:

__onDraggingSquare

(
  • manager
  • mstate
)
private

Parameters:

__onDragStart

(
  • manager
  • mstate
)
private

Parameters:

__onLocaleChanged

() private
Called when the locale is changed.

__onMouseDown

(
  • manager
  • mstate
)
private

Parameters:

__onMouseMove

(
  • manager
  • mstate
)
private

Parameters:

__onValueChanged

() private

_bindEvent

(
  • id
  • element
  • evName
  • callback
)
private

Inherited from photonui.Base: src/base.js:229

Javascript event binding (for internal use).

Parameters:

  • id String
    An unique id for the event.
  • element DOMElement
    The element on which the event will be bind.
  • evName String
    The event name (e.g. "mousemove", "click",...).
  • callback Function
    The function that will be called when the event occured.

_buildHtml

() private

Inherited from photonui.Widget but overwritten in src/interactive/colorpicker.js:201

Build the widget HTML.

_callCallbacks

(
  • wEvent
  • params
)
private

Inherited from photonui.Base: src/base.js:288

Call all callbacks for the given wEvent. NOTE: the first argument passed to the callback is the current widget. NOTEĀ²: if the thisArg of the callback is null, this will be binded to the current widget.

Parameters:

  • wEvent String
    The widget event.
  • params Array
    Parametters that will be sent to the callbacks.

_pointerAngle

(
  • mstate
)
Number private

the angle of the pointer with the horizontal line that pass by the center of the hue circle.

Parameters:

Returns:

Number:

the angle in degree.

_pointerOnCircle

(
  • mstate
)
Boolean private

Is the pointer on the hue circle?

Parameters:

Returns:

_pointerOnSquare

(
  • mstate
)
Boolean private

Is the pointer on the SB Square?

Parameters:

Returns:

_registerWEvents

(
  • wEvents
)
private

Inherited from photonui.Base: src/base.js:272

Register available wEvent.

Parameters:

_unbindEvent

(
  • id
)
private

Inherited from photonui.Base: src/base.js:253

Unbind javascript event.

Parameters:

  • id String
    The id of the event.

_updateCanvas

() private

Update the canvas

_updateH

() private

Update hue circle

_updateProperties

(
  • properties
)
deprecated private

Inherited from photonui.Base: src/base.js:209

Force the update of the given properties. This method is deprecated. One should use '@photonui-update' abitbol's annotation on concerned properties.

Parameters:

  • properties Array
    The properties to update.

_updateSB

() private

Update saturation/brightness square

_updateSBmask

() private

Update saturation/brightness square mask

_visibilityChanged

(
  • visibility
)
private
Called when the visibility changes.

Parameters:

  • visibility Boolean

    Current visibility state (otptional, defaut=this.visible)

addClass

(
  • className
)
Add a class to the outer HTML element of the widget.

Parameters:

  • className String
    The class to add.

destroy

()

Inherited from photonui.Base but overwritten in src/widget.js:367

Destroy the widget.

hide

()
Hide the widget (equivalent to widget.visible = false).

registerCallback

(
  • id
  • wEvent
  • callback
  • thisArg
)

Inherited from photonui.Base: src/base.js:169

Register a callback for any PhotonUI/Widget event (called wEvent). Callback signature: function (Object(Base/Widget) [, arg1 [, arg2 [, ...]]])

Parameters:

  • id String
    An unique id for the callback.
  • wEvent String
    the PhotonUI/Widget event name.
  • callback Function
    The callback function.
  • thisArg Object
    The value of this (optionnal, default = current widget).

removeCallback

(
  • id
)

Inherited from photonui.Base: src/base.js:193

Remove a registered callback.

Parameters:

  • id String
    The id of the callback.

removeClass

(
  • className
)
Remove a class from the outer HTML element of the widget.

Parameters:

  • className String
    The class to remove.

show

()
Display the widget (equivalent to widget.visible = true).

unparent

()
Detache the widget from its parent.

Properties

__buffH

HTMLCanvasElement private

Buffer canvas for hue circle.

__buffSB

HTMLCanvasElement private

Buffer canvas for saturation/brightness square.

__callbacks

Object private

Inherited from photonui.Base: src/base.js:142

Object containing references to registered callbacks.

__disableSBUpdate

Boolean private

FLAG: Disable SB square update.

Default: false

__events

Object private

Inherited from photonui.Base: src/base.js:132

Object containing references javascript events binding (for widget internal use).

__html

Object private
Object containing references to the widget HTML elements

__mouseManager

photonui.MouseManager private

Mouse manager.

absolutePosition

Object
Absolute position of the widget on the page. {x: Number, y: Number}

contextMenu

photonui.PopupWindow
The managed contextual menu.

Default: null (= no context menu)

contextMenuName

String
The name of the managed contextual menu (photonui.PopupWindow().name).

Default: null (= no context menu)

data

Object

Inherited from photonui.Base: src/base.js:113

Arbitrary data

Default: {}

html

HTMLElement

Inherited from photonui.Widget but overwritten in src/interactive/colorpicker.js:140

Html outer element of the widget (if any).

Default: null

layoutOptions

Object
Layout options.

Default: {}

name

String
The unique name of the widget.

Default: "widget-" + uuid.v4()

offsetHeight

Number
Widget height (outer HTML element).

offsetWidth

Number
Widget width (outer HTML element).

parent

photonui.Widget
The parent widget.

Default: null (no parent)

parentName

String
The parent widget name.

Default: null (no parent)

tooltip

String
Tooltip.

Default: null

value

String

The value (color in rgb hexadecimal format (e.g. "#ff0000")).

visible

Boolean
Is the widget visible or hidden.

Default: true