mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-10 18:50:54 +00:00
textBox#setAlignment method added to avoid complete reconstruction when changing text alignment
This commit is contained in:
parent
08b71731d1
commit
d0ed55758b
@ -144,8 +144,7 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
this._addAttribute(
|
||||
"alignment",
|
||||
alignment,
|
||||
"left",
|
||||
this._onChange(true, true),
|
||||
"left"
|
||||
);
|
||||
|
||||
// colors:
|
||||
@ -228,6 +227,21 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
this.setText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the alignment attribute.
|
||||
*
|
||||
* @name module:visual.TextBox#setAlignment
|
||||
* @public
|
||||
* @param {boolean} alignment - alignment of the text
|
||||
* @param {boolean} [log= false] - whether of not to log
|
||||
*/
|
||||
setAlignment(alignment = "left", log = false) {
|
||||
this._setAttribute("alignment", alignment, log);
|
||||
if (this._pixi !== undefined) {
|
||||
this._pixi.setInputStyle("text-align", alignment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For tweaking the underlying input value.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user