mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-10 18:50:54 +00:00
Merge pull request #507 from lightest/CU-2da76e8_incorrect_size_on_rebuild
Incorrect behavior on textbox refresh when size attribute becomes negative
This commit is contained in:
commit
4937ab5308
@ -477,9 +477,12 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
{
|
{
|
||||||
this._pixi.on("input", (textContent) => {
|
this._pixi.on("input", (textContent) => {
|
||||||
this._text = textContent;
|
this._text = textContent;
|
||||||
let size = [this._pixi.width, this._pixi.height];
|
if (this._fitToContent)
|
||||||
size = util.to_unit(size, "pix", this._win, this._units);
|
{
|
||||||
this._setAttribute("size", size, false);
|
// make sure that size attribute is updated when fitToContent = true
|
||||||
|
const size = util.to_unit([this._pixi.width, this._pixi.height], "pix", this._win, this._units);
|
||||||
|
this._setAttribute("size", size, false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,8 +520,8 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
const letterHeight_px = Math.round(this._getLengthPix(this._letterHeight));
|
const letterHeight_px = Math.round(this._getLengthPix(this._letterHeight));
|
||||||
const padding_px = Math.round(this._getLengthPix(this._padding));
|
const padding_px = Math.round(this._getLengthPix(this._padding));
|
||||||
const borderWidth_px = Math.round(this._getLengthPix(this._borderWidth));
|
const borderWidth_px = Math.round(this._getLengthPix(this._borderWidth));
|
||||||
const width_px = Math.round(this._getLengthPix(this._size[0]));
|
const width_px = Math.abs(Math.round(this._getLengthPix(this._size[0])));
|
||||||
const height_px = Math.round(this._getLengthPix(this._size[1]));
|
const height_px = Math.abs(Math.round(this._getLengthPix(this._size[1])));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// input style properties eventually become CSS, so same syntax applies
|
// input style properties eventually become CSS, so same syntax applies
|
||||||
|
Loading…
Reference in New Issue
Block a user