blockly > FieldAngle

FieldAngle class

Class for an editable angle field.

Signature:

export declare class FieldAngle extends FieldInput<number> 

Extends: FieldInput<number>

Constructors

Constructor Modifiers Description
(constructor)(value, validator, config) Constructs a new instance of the FieldAngle class

Properties

Property Modifiers Type Description
CLOCKWISE

static

readonly

(not declared) Default property describing which direction makes an angle field's value increase. Angle increases clockwise (true) or counterclockwise (false).
HALF

static

readonly

number Half the width of protractor image.
OFFSET

static

readonly

(not declared) The default offset of 0 degrees (and all angles). Always offsets in the counterclockwise direction, regardless of the field's clockwise property. Usually either 0 (0 = right) or 90 (0 = up).
RADIUS

static

readonly

number Radius of protractor circle. Slightly smaller than protractor size since otherwise SVG crops off half the border at the edges.
ROUND

static

readonly

(not declared) The default amount to round angles to when using a mouse or keyboard nav input. Must be a positive integer to support keyboard navigation.
symbol_ protected SVGTSpanElement | null The degree symbol for this field.
WRAP

static

readonly

(not declared) The default maximum angle to allow before wrapping. Usually either 360 (for 0 to 359.9) or 180 (for -179.9 to 180).

Methods

Method Modifiers Description
configure_(config) protected Configure the field based on the given map of options.
doClassValidation_(newValue) protected Ensure that the input value is a valid angle.
initView() Create the block UI for this field.
onHtmlInputKeyDown_(e) protected Handle key down to the editor.
onMouseMove_(e) protected Set the angle to match the mouse's position.
render_() protected Updates the angle when the field rerenders.
showEditor_(e) protected Create and show the angle field's editor.