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

Merge branch '2022.1.0' of github.com:apitiot/psychojs into 2022.1.0

This commit is contained in:
Alain Pitiot 2022-01-25 11:40:44 +01:00
commit 3424b24b43
9 changed files with 28 additions and 9 deletions

View File

@ -163,7 +163,6 @@ jobs:
name: Join reports
needs: [tests]
runs-on: ubuntu-latest
continue-on-error: true
steps:
# START: install psychojs_testing
- name: Checkout psychojs_testing

View File

@ -358,6 +358,26 @@ export function shuffle(array, randomNumberGenerator = undefined)
return array;
}
/**
* Pick a random value from an array, uses `util.shuffle` to shuffle the array and returns the last value.
*
* @name module:util.randchoice
* @function
* @public
* @param {Object[]} array - the input 1-D array
* @param {Function} [randomNumberGenerator = undefined] - A function used to generated random numbers in the interal [0, 1). Defaults to Math.random
* @return {Object[]} a chosen value from the array
*/
export function randchoice(array, randomNumberGenerator = undefined)
{
if (randomNumberGenerator === undefined)
{
randomNumberGenerator = Math.random;
}
const j = Math.floor(randomNumberGenerator() * array.length);
return array[j]
}
/**
* Get the position of the object, in pixel units
*

View File

@ -299,7 +299,7 @@ export class FaceDetector extends VisualStim
this._pixi.scale.x = 1;
this._pixi.scale.y = -1;
this._pixi.rotation = this.ori * Math.PI / 180;
this._pixi.rotation = -this.ori * Math.PI / 180;
this._pixi.position = to_pixiPoint(this.pos, this.units, this.win);
this._pixi.alpha = this._opacity;

View File

@ -312,7 +312,7 @@ export class ImageStim extends util.mix(VisualStim).with(ColorMixin)
// set the position, rotation, and anchor (image centered on pos):
this._pixi.position = to_pixiPoint(this.pos, this.units, this.win);
this._pixi.rotation = this.ori * Math.PI / 180;
this._pixi.rotation = -this.ori * Math.PI / 180;
this._pixi.anchor.x = 0.5;
this._pixi.anchor.y = 0.5;

View File

@ -401,7 +401,7 @@ export class MovieStim extends VisualStim
// set the position, rotation, and anchor (movie centered on pos):
this._pixi.position = to_pixiPoint(this.pos, this.units, this.win);
this._pixi.rotation = this.ori * Math.PI / 180;
this._pixi.rotation = -this.ori * Math.PI / 180;
this._pixi.anchor.x = 0.5;
this._pixi.anchor.y = 0.5;

View File

@ -260,7 +260,7 @@ export class ShapeStim extends util.mix(VisualStim).with(ColorMixin, WindowMixin
// set polygon position and rotation:
this._pixi.position = to_pixiPoint(this.pos, this.units, this.win);
this._pixi.rotation = this.ori * Math.PI / 180.0;
this._pixi.rotation = -this.ori * Math.PI / 180.0;
}
/**

View File

@ -728,7 +728,7 @@ export class Slider extends util.mix(VisualStim).with(ColorMixin, WindowMixin)
this._pixi.scale.x = 1;
this._pixi.scale.y = -1;
this._pixi.rotation = this._ori * Math.PI / 180;
this._pixi.rotation = -this._ori * Math.PI / 180;
this._pixi.position = this._getPosition_px();
this._pixi.alpha = this._opacity;
@ -1189,7 +1189,7 @@ export class Slider extends util.mix(VisualStim).with(ColorMixin, WindowMixin)
const labelText = new PIXI.Text(this._labels[l], labelTextStyle);
labelText.position.x = this._labelPositions_px[l][0];
labelText.position.y = this._labelPositions_px[l][1];
labelText.rotation = (this._ori + this._labelOri) * Math.PI / 180;
labelText.rotation = -(this._ori + this._labelOri) * Math.PI / 180;
labelText.anchor = this._labelAnchor;
labelText.alpha = 1;

View File

@ -485,7 +485,7 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
this._pixi.scale.x = this._flipHoriz ? -1 : 1;
this._pixi.scale.y = this._flipVert ? 1 : -1;
this._pixi.rotation = this._ori * Math.PI / 180;
this._pixi.rotation = -this._ori * Math.PI / 180;
[this._pixi.x, this._pixi.y] = util.to_px(this._pos, this._units, this._win);
this._pixi.alpha = this._opacity;

View File

@ -425,7 +425,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
this._pixi.scale.x = this._flipHoriz ? -1 : 1;
this._pixi.scale.y = this._flipVert ? 1 : -1;
this._pixi.rotation = this._ori * Math.PI / 180;
this._pixi.rotation = -this._ori * Math.PI / 180;
this._pixi.position = to_pixiPoint(this.pos, this.units, this.win);
this._pixi.alpha = this._opacity;