mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-12 16:48:10 +00:00
Merge pull request #492 from apitiot/2022.1.3
BF: issue with bounding box estimation for TextStim
This commit is contained in:
commit
17115c7227
@ -209,8 +209,8 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Get the default letter height given the stimulus' units.
|
* Get the default letter height given the stimulus' units.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_getDefaultLetterHeight
|
* @name module:visual.TextStim#_getDefaultLetterHeight
|
||||||
* @return {number} - the letter height corresponding to this stimulus' units.
|
|
||||||
* @protected
|
* @protected
|
||||||
|
* @return {number} - the letter height corresponding to this stimulus' units.
|
||||||
*/
|
*/
|
||||||
_getDefaultLetterHeight()
|
_getDefaultLetterHeight()
|
||||||
{
|
{
|
||||||
@ -232,8 +232,8 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Get the default wrap width given the stimulus' units.
|
* Get the default wrap width given the stimulus' units.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_getDefaultWrapWidth
|
* @name module:visual.TextStim#_getDefaultWrapWidth
|
||||||
* @return {number} - the wrap width corresponding to this stimulus' units.
|
|
||||||
* @protected
|
* @protected
|
||||||
|
* @return {number} - the wrap width corresponding to this stimulus' units.
|
||||||
*/
|
*/
|
||||||
_getDefaultWrapWidth()
|
_getDefaultWrapWidth()
|
||||||
{
|
{
|
||||||
@ -252,11 +252,10 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bounding gox.
|
* Get the bounding box.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#getBoundingBox
|
* @name module:visual.TextStim#getBoundingBox
|
||||||
* @function
|
* @public
|
||||||
* @protected
|
|
||||||
* @param {boolean} [tight= false] - whether or not to fit as closely as possible to the text
|
* @param {boolean} [tight= false] - whether or not to fit as closely as possible to the text
|
||||||
* @return {number[]} - the bounding box, in the units of this TextStim
|
* @return {number[]} - the bounding box, in the units of this TextStim
|
||||||
*/
|
*/
|
||||||
@ -321,9 +320,8 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Estimate the bounding box.
|
* Estimate the bounding box.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_estimateBoundingBox
|
* @name module:visual.TextStim#_estimateBoundingBox
|
||||||
* @function
|
|
||||||
* @override
|
|
||||||
* @protected
|
* @protected
|
||||||
|
* @override
|
||||||
*/
|
*/
|
||||||
_estimateBoundingBox()
|
_estimateBoundingBox()
|
||||||
{
|
{
|
||||||
@ -340,7 +338,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
const anchor = this._getAnchor();
|
const anchor = this._getAnchor();
|
||||||
this._boundingBox = new PIXI.Rectangle(
|
this._boundingBox = new PIXI.Rectangle(
|
||||||
this._pos[0] - anchor[0] * textSize[0],
|
this._pos[0] - anchor[0] * textSize[0],
|
||||||
this._pos[1] - textSize[1] - anchor[1] * textSize[1],
|
this._pos[1] - textSize[1] + anchor[1] * textSize[1],
|
||||||
textSize[0],
|
textSize[0],
|
||||||
textSize[1],
|
textSize[1],
|
||||||
);
|
);
|
||||||
@ -352,7 +350,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Get the PIXI Text Style applied to the PIXI.Text
|
* Get the PIXI Text Style applied to the PIXI.Text
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_getTextStyle
|
* @name module:visual.TextStim#_getTextStyle
|
||||||
* @private
|
* @protected
|
||||||
*/
|
*/
|
||||||
_getTextStyle()
|
_getTextStyle()
|
||||||
{
|
{
|
||||||
@ -394,8 +392,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Update the stimulus, if necessary.
|
* Update the stimulus, if necessary.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_updateIfNeeded
|
* @name module:visual.TextStim#_updateIfNeeded
|
||||||
* @function
|
* @protected
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
_updateIfNeeded()
|
_updateIfNeeded()
|
||||||
{
|
{
|
||||||
@ -445,7 +442,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
// refine the estimate of the bounding box:
|
// refine the estimate of the bounding box:
|
||||||
this._boundingBox = new PIXI.Rectangle(
|
this._boundingBox = new PIXI.Rectangle(
|
||||||
this._pos[0] - anchor[0] * this._size[0],
|
this._pos[0] - anchor[0] * this._size[0],
|
||||||
this._pos[1] - this._size[1] - anchor[1] * this._size[1],
|
this._pos[1] - this._size[1] + anchor[1] * this._size[1],
|
||||||
this._size[0],
|
this._size[0],
|
||||||
this._size[1],
|
this._size[1],
|
||||||
);
|
);
|
||||||
@ -455,8 +452,7 @@ export class TextStim extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
* Convert the alignment attributes into an anchor.
|
* Convert the alignment attributes into an anchor.
|
||||||
*
|
*
|
||||||
* @name module:visual.TextStim#_getAnchor
|
* @name module:visual.TextStim#_getAnchor
|
||||||
* @function
|
* @protected
|
||||||
* @private
|
|
||||||
* @return {number[]} - the anchor
|
* @return {number[]} - the anchor
|
||||||
*/
|
*/
|
||||||
_getAnchor()
|
_getAnchor()
|
||||||
|
@ -208,7 +208,6 @@ export class VisualStim extends util.mix(MinimalStim).with(WindowMixin)
|
|||||||
* Estimate the bounding box.
|
* Estimate the bounding box.
|
||||||
*
|
*
|
||||||
* @name module:visual.VisualStim#_estimateBoundingBox
|
* @name module:visual.VisualStim#_estimateBoundingBox
|
||||||
* @function
|
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_estimateBoundingBox()
|
_estimateBoundingBox()
|
||||||
@ -224,7 +223,6 @@ export class VisualStim extends util.mix(MinimalStim).with(WindowMixin)
|
|||||||
* Get the bounding box in pixel coordinates
|
* Get the bounding box in pixel coordinates
|
||||||
*
|
*
|
||||||
* @name module:visual.VisualStim#contains
|
* @name module:visual.VisualStim#contains
|
||||||
* @function
|
|
||||||
* @protected
|
* @protected
|
||||||
* @returns {PIXI.Rectangle} the bounding box, in pixel coordinates
|
* @returns {PIXI.Rectangle} the bounding box, in pixel coordinates
|
||||||
*/
|
*/
|
||||||
@ -265,7 +263,6 @@ export class VisualStim extends util.mix(MinimalStim).with(WindowMixin)
|
|||||||
* with _addAttribute.
|
* with _addAttribute.
|
||||||
*
|
*
|
||||||
* @name module:visual.VisualStim#_onChange
|
* @name module:visual.VisualStim#_onChange
|
||||||
* @function
|
|
||||||
* @protected
|
* @protected
|
||||||
* @param {boolean} [withPixi = false] - whether or not the PIXI representation must
|
* @param {boolean} [withPixi = false] - whether or not the PIXI representation must
|
||||||
* also be updated
|
* also be updated
|
||||||
|
Loading…
Reference in New Issue
Block a user