Skip to content

Commit

Permalink
Allow textField.autoSize to increase TextField size in canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Jun 23, 2015
1 parent 06e93a2 commit 98aacf1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions openfl/_internal/renderer/canvas/CanvasTextField.hx
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,14 @@ class CanvasTextField {
}

var measurements = measureText (textField);
var bounds = textField.bounds;

graphics.__canvas.width = Math.ceil (textField.__width);
graphics.__canvas.height = Math.ceil (textField.__height);
graphics.__canvas.width = Math.ceil (bounds.width);
graphics.__canvas.height = Math.ceil (bounds.height);

if (textField.border || textField.background) {

context.rect (0.5, 0.5, textField.width - 1, textField.height - 1);
context.rect (0.5, 0.5, bounds.width, bounds.height);

if (textField.background) {

Expand Down Expand Up @@ -383,7 +384,7 @@ class CanvasTextField {

if (textField.border) {

context.rect (0.5, 0.5, textField.width - 1, textField.height - 1);
context.rect (0.5, 0.5, textField.width, textField.height);

} else {

Expand Down
2 changes: 1 addition & 1 deletion openfl/_legacy/media/SoundChannel.hx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class SoundChannel extends EventDispatcher {
__dynamicSoundCount--;

}

var completeEvent = new Event (Event.SOUND_COMPLETE);
dispatchEvent (completeEvent);

Expand Down
1 change: 1 addition & 0 deletions openfl/text/TextField.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,7 @@ class TextField extends InteractiveObject {

}


@:noCompletion private function get_bounds ():Rectangle {

if (!__dirtyBounds) {
Expand Down

0 comments on commit 98aacf1

Please sign in to comment.