1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00

anchoring and alignment fixed;

This commit is contained in:
lgtst 2022-03-30 22:39:47 +03:00
parent 0259fe2518
commit 08b71731d1

View File

@ -392,7 +392,7 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
color: this._color === undefined || this._color === null ? 'transparent' : new Color(this._color).hex,
fontWeight: (this._bold) ? "bold" : "normal",
fontStyle: (this._italic) ? "italic" : "normal",
textAlign: this._alignment,
padding: padding_px + "px",
multiline,
text: this._text,
@ -523,11 +523,13 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
this._pixi.disabled = !this._editable;
const anchor = this._getAnchor();
this._pixi.pivot.x = anchor[0] * this._pixi.width;
this._pixi.pivot.y = anchor[1] * this._pixi.height;
this._pixi.scale.x = this._flipHoriz ? -1 : 1;
this._pixi.scale.y = this._flipVert ? 1 : -1;
this._pixi.pivot.x = anchor[0] * this._pixi.width;
// when setting PIXI.Container.scale.y = -1
// PIXI.Container.height becomes negative
this._pixi.pivot.y = anchor[1] * -this._pixi.height;
this._pixi.rotation = -this._ori * Math.PI / 180;
[this._pixi.x, this._pixi.y] = util.to_px(this._pos, this._units, this._win);