If you apply setSize to the Dynamic BitmapText the scissor is now calculated based on the parent transforms, not just the local ones, meaning you can crop Bitmap Text objects that exist within Containers. Fix #4653

This commit is contained in:
Richard Davey 2020-08-03 11:33:41 +01:00
parent c12eb98c49
commit 47a62cd30c

View file

@ -36,20 +36,6 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce
renderer.setPipeline(pipeline, src);
var crop = (src.cropWidth > 0 || src.cropHeight > 0);
if (crop)
{
pipeline.flush();
renderer.pushScissor(
src.x,
src.y,
src.cropWidth * src.scaleX,
src.cropHeight * src.scaleY
);
}
var camMatrix = pipeline._tempMatrix1;
var spriteMatrix = pipeline._tempMatrix2;
var calcMatrix = pipeline._tempMatrix3;
@ -80,6 +66,20 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce
camMatrix.multiply(spriteMatrix, calcMatrix);
}
var crop = (src.cropWidth > 0 || src.cropHeight > 0);
if (crop)
{
pipeline.flush();
renderer.pushScissor(
calcMatrix.tx,
calcMatrix.ty,
src.cropWidth * calcMatrix.scaleX,
src.cropHeight * calcMatrix.scaleY
);
}
var frame = src.frame;
var texture = frame.glTexture;
var textureX = frame.cutX;