Skip to content

Commit

Permalink
Merge pull request #772 from xyfeng/master
Browse files Browse the repository at this point in the history
[Bug Fix] #766, text() does not follow rectMode()
  • Loading branch information
Lauren McCarthy committed Jun 25, 2015
2 parents ef64033 + ff08ed8 commit d8cea74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/p5.js
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,10 @@ amdclean['core_p5Renderer2D'] = function (require, core_core, core_canvas, core_
}
}
}
if (this._pInst._rectMode === constants.CENTER) {
x -= maxWidth / 2;
y -= maxHeight / 2;
}
switch (this.drawingContext.textAlign) {
case constants.CENTER:
x += maxWidth / 2;
Expand Down
6 changes: 6 additions & 0 deletions src/core/p5.Renderer2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,12 @@ define(function(require) {
}
}

if (this._pInst._rectMode === constants.CENTER ){

x -= maxWidth / 2;
y -= maxHeight / 2;
}

switch (this.drawingContext.textAlign) {

case constants.CENTER:
Expand Down

0 comments on commit d8cea74

Please sign in to comment.