ButtonStim

visual ButtonStim

ButtonStim visual stimulus.

Constructor

new ButtonStim(options)

Source:
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
win module:core.Window

the associated Window

name String

the name used when logging messages from this stimulus

text string <optional>
""

the text to be rendered

font string <optional>
"Arial"

the font family

pos Array.<number> <optional>
[0, 0]

the position of the center of the text

anchor string <optional>
"center"

horizontal alignment

units string <optional>
"norm"

the units of the text size and position

color Color <optional>
Color("white")

the background color

fillColor Color <optional>
Color("darkgrey")

the fill color

borderColor Color <optional>
Color("white")

the border color

borderWidth Color <optional>
0

the border width

opacity number <optional>
1.0

the opacity

letterHeight number <optional>

the height of the text

bold boolean <optional>
true

whether or not the text is bold

italic boolean <optional>
false

whether or not the text is italic

autoDraw boolean <optional>
false

whether or not the stimulus should be automatically drawn on every frame flip

autoLog boolean <optional>
false

whether or not to log

Extends

Members

isClicked

Source:

Is this button currently being clicked on?

numClicks

Source:

How many times has this button been clicked on?

Methods

(protected) _addEventListeners()

Source:
Overrides:

Add event listeners to text-box object. Method is called internally upon object construction.

(protected) _estimateBoundingBox()

Source:
Inherited From:

Estimate the bounding box.

(protected) _getAnchor() → {Array.<number>}

Source:
Overrides:

Convert the anchor attribute into numerical values.

Returns:
  • the anchor, as an array of numbers in [0,1]
Type
Array.<number>

(protected) _getDefaultLetterHeight() → {number}

Source:
Overrides:

Get the default letter height given the stimulus' units.

Returns:
  • the letter height corresponding to this stimulus' units.
Type
number

(protected) _getTextInputOptions()

Source:
Overrides:

Get the TextInput options applied to the PIXI.TextInput.

(protected) _updateIfNeeded()

Source:
Overrides:
To Do:
  • take size into account

Update the stimulus, if necessary.

clear()

Source:
Overrides:

Clears the current text value.

getText() → {string}

Source:
Overrides:

For accessing the underlying input value.

Returns:
  • the current text value of the underlying input element.
Type
string

reset()

Source:
Overrides:

Clears the current text value or sets it back to match the placeholder.

setAlignment(alignment, logopt)

Source:
Overrides:

Setter for the alignment attribute.

Parameters:
Name Type Attributes Default Description
alignment boolean left

alignment of the text

log boolean <optional>
false

whether or not to log

setAnchor(anchor, logopt)

Source:
Overrides:

Setter for the anchor attribute.

Parameters:
Name Type Attributes Default Description
anchor boolean center

anchor of the textbox

log boolean <optional>
false

whether or not to log

setBorderColor(borderColor, logopt)

Source:
Overrides:

Setter for the borderColor attribute.

Parameters:
Name Type Attributes Default Description
borderColor Color

border color of the text box

log boolean <optional>
false

whether or not to log

setColor(color, logopt)

Source:
Overrides:

Setter for the color attribute.

Parameters:
Name Type Attributes Default Description
color boolean

color of the text

log boolean <optional>
false

whether or not to log

setFillColor(fillColor, logopt)

Source:
Overrides:

Setter for the fillColor attribute.

Parameters:
Name Type Attributes Default Description
fillColor boolean

fill color of the text box

log boolean <optional>
false

whether or not to log

setFitToContent(fitToContent, logopt)

Source:
Overrides:

Setter for the fitToContent attribute.

Parameters:
Name Type Attributes Default Description
fitToContent boolean

whether or not to autoresize textbox to fit to text content

log boolean <optional>
false

whether or not to log

setFont(font, logopt)

Source:
Overrides:

Set the font for textbox.

Parameters:
Name Type Attributes Default Description
font string Arial

the font family

log boolean <optional>
false

whether to log

setLanguageStyle(languageStyle, logopt)

Source:
Overrides:

Setter for the languageStyle attribute.

Parameters:
Name Type Attributes Default Description
languageStyle String LTR

text direction in textbox, accepts values ["LTR", "RTL", "Arabic"]

log boolean <optional>
false

whether or not to log

setLetterHeight(fontSizeopt, logopt)

Source:
Overrides:

Set letterHeight (font size) for textbox.

Parameters:
Name Type Attributes Default Description
fontSize string <optional>
<default value>

the size of the font

log boolean <optional>
false

whether to log

setSize(size, logopt)

Source:
Overrides:

Setter for the size attribute.

Parameters:
Name Type Attributes Default Description
size boolean

whether or not to wrap the text at the given width

log boolean <optional>
false

whether or not to log

setText(text)

Source:
Overrides:

For tweaking the underlying input value.

Parameters:
Name Type Description
text string