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

visual/TextBox+TextInput: skip event listeners for ButtonStim

This commit is contained in:
Sotiri Bakagiannis 2021-05-10 14:04:32 +01:00
parent 05eb0aabf0
commit 61e41553d3
2 changed files with 7 additions and 1 deletions

View File

@ -404,6 +404,13 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
this._pixi.destroy(true);
}
this._pixi = new TextInput(this._getTextInputOptions());
// listeners required for regular textboxes, but may cause problems with button stimuli
if (!(this instanceof ButtonStim))
{
this._pixi._addListeners();
}
// check if other TextBox instances are already in focus
const { _drawList = [] } = this.psychoJS.window;
const otherTextBoxWithFocus = _drawList.some(item => item instanceof TextBox && item._pixi && item._pixi._hasFocus());

View File

@ -56,7 +56,6 @@ export class TextInput extends PIXI.Container
this._createDOMInput();
this.substituteText = true;
this._setState('DEFAULT');
this._addListeners();
}