mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-10 10:40:54 +00:00
Merge pull request #46 from psychopy/rectSetSize
BF: Add setSize method to Rect
This commit is contained in:
commit
1fbb67a5e6
@ -76,7 +76,7 @@ export class Rect extends ShapeStim {
|
||||
* @name module:visual.Rect#setWidth
|
||||
* @public
|
||||
* @param {number} width - the rectange width
|
||||
* @param {boolean} [log= false] - whether of not to log
|
||||
* @param {boolean} [log= false] - whether or not to log
|
||||
*/
|
||||
setWidth(width, log = false) {
|
||||
this._psychoJS.logger.debug('set the width of Rect: ', this.name, 'to: ', width);
|
||||
@ -92,7 +92,7 @@ export class Rect extends ShapeStim {
|
||||
* @name module:visual.Rect#setHeight
|
||||
* @public
|
||||
* @param {number} height - the rectange height
|
||||
* @param {boolean} [log= false] - whether of not to log
|
||||
* @param {boolean} [log= false] - whether or not to log
|
||||
*/
|
||||
setHeight(height, log = false) {
|
||||
this._psychoJS.logger.debug('set the height of Rect: ', this.name, 'to: ', height);
|
||||
@ -101,7 +101,23 @@ export class Rect extends ShapeStim {
|
||||
this._updateVertices();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter for the size attribute.
|
||||
*
|
||||
* @name module:visual.Rect#setSize
|
||||
* @public
|
||||
* @param {number[]} size - the [x, y] size of the rectangle
|
||||
* @param {boolean} [log= false] - whether or not to log
|
||||
*/
|
||||
setSize(size, log = false) {
|
||||
this._psychoJS.logger.debug('set the size of Rect: ', this.name, 'to: ', size);
|
||||
|
||||
this._setAttribute('width', size[0], log);
|
||||
this._setAttribute('height', size[1], log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the base shape vertices.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user