Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text clipping when applying a shadow to it #3226

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions flixel/text/FlxText.hx
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,13 @@ class FlxText extends FlxSprite
// Account for gutter
var newHeight:Int = Math.ceil(textfieldHeight) + vertGutter;

// Increase the dimensions of the bitmap to allow for the drawing of the shadow properly.
if (shadowOffset != null)
{
newWidth += Math.ceil(Math.abs(shadowOffset.x));
newHeight += Math.ceil(Math.abs(shadowOffset.y));
}

// prevent text height from shrinking on flash if text == ""
if (textField.textHeight == 0)
{
Expand Down Expand Up @@ -1038,11 +1045,12 @@ class FlxText extends FlxSprite

for (i in 0...iterations)
{
copyTextWithOffset(delta, delta);
copyTextWithOffset(shadowOffset.x >= 0 ?
shadowOffset.x : delta, shadowOffset.y >= 0 ?
shadowOffset.y : delta);
}

_matrix.translate(-shadowOffset.x * borderSize, -shadowOffset.y * borderSize);

case OUTLINE:
// Render an outline around the text
// (do 8 offset draw calls)
Expand Down
Loading