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

22ybz82 "greedy" focus fix, also window#rootContainer now has sortableChildren=true;

This commit is contained in:
lgtst 2022-04-14 19:53:03 +03:00
parent fb89db2b6c
commit f7171287fc
3 changed files with 12 additions and 3 deletions

View File

@ -438,6 +438,9 @@ export class Window extends PsychObject
// create a top-level PIXI container:
this._rootContainer = new PIXI.Container();
// sorts children according to their zIndex value. Higher zIndex means it will be moved towards the end of the array,
// and thus rendered on top of previous one.
this._rootContainer.sortableChildren = true;
this._rootContainer.interactive = true;
this._rootContainer.filters = [this._adjustmentFilter];

View File

@ -733,6 +733,7 @@ export class Slider extends util.mix(VisualStim).with(ColorMixin, WindowMixin)
this._pixi.position = this._getPosition_px();
this._pixi.alpha = this._opacity;
this._pixi.zIndex = this._depth;
// make sure that the dependent Stimuli are also updated:
for (const dependentStim of this._dependentStims)

View File

@ -1,12 +1,12 @@
/**
* TextInput encapsulates an html <input> element into a PIXI Container.
*
* @author 'Mwni' (https://github.com/Mwni)
* @author 'Mwni' (https://github.com/Mwni), Nikita Agafonov
* @copyright (c) 2018 Mwni
* @license Distributed under the terms of the MIT License
*
* @note TextInput was initially developed by 'Mwni' and is available under the MIT License.
* We are currently using it almost as is but will be making modification in the near future.
* We are currently modifying it to our needs.
*/
import * as PIXI from "pixi.js-legacy";
@ -558,7 +558,7 @@ export class TextInput extends PIXI.Container
}
_onSurrogateFocus()
{
{
this._setDOMInputVisible(true);
// sometimes the input is not being focused by the mouseclick
setTimeout(this._ensureFocus.bind(this), 10);
@ -824,6 +824,11 @@ function DefaultBoxGenerator(styles)
let style = styles[state.toLowerCase()];
let box = new PIXI.Graphics();
box.interactive = true;
box.on('pointerdown', () => {
this._dom_input.focus();
});
box.beginFill(style.fill, style.alpha);
if (style.stroke)