feathersui-starling icon indicating copy to clipboard operation
feathersui-starling copied to clipboard

TextFieldTextRenderer: gutter clipping when inside container with scale < 1

Open subdan opened this issue 8 years ago • 6 comments
trafficstars

Hello, Josh.

I have an issue with Label. If I place Label inside container with .scale = 0.3 the text inside Label will be cutted. It happens only on iPhone with Retina display. How to fix this issue?

Actual result

screenshot_1

Expected result

screenshot_2

Code inside StarlingRoot.as

const PADDING:int = 10;
const TEXT_WIDTH:int = 280;
const TEXT_HEIGHT:int = 60;

var container:Sprite = new Sprite();
container.scale = 0.3;
addChild(container);
			
var labelBG:Quad = new Quad(TEXT_WIDTH, TEXT_HEIGHT, 0xCCCCCC);
labelBG.x = PADDING;
labelBG.y = PADDING;
container.addChild(labelBG);
			
var label:Label = new Label();
label.width = TEXT_WIDTH;
label.height = TEXT_HEIGHT;
label.x = PADDING;
label.y = PADDING;
label.textRendererFactory = function ():ITextRenderer
{
	var textRenderer:TextFieldTextRenderer = new TextFieldTextRenderer();
	textRenderer.updateSnapshotOnScaleChange = true;
	textRenderer.embedFonts = true;
	return textRenderer;
};
label.text = "HELLO";
label.fontStyles = new TextFormat("Arial", 20, 0x000000,Align.LEFT);
container.addChild(label);

How to test the issue with ADL: adl.exe -profile extendedMobileDevice -screensize 640x1136:640x1136 -XscreenDPI 556 -XversionPlatform IOS game-android.xml bin

subdan avatar Mar 31 '17 13:03 subdan

I can reproduce this issue. As a workaround, you can enable the TextField's gutter:

textRenderer.useGutter = true;

joshtynjala avatar Mar 31 '17 15:03 joshtynjala

Thanks, Josh!

subdan avatar Mar 31 '17 16:03 subdan

Hello, Josh. When do you plan to fix this issue?

subdan avatar Apr 26 '17 15:04 subdan

I plan to look at it some time in the next month or two for the upcoming Feathers 3.3.

joshtynjala avatar Apr 26 '17 15:04 joshtynjala

Ok.

subdan avatar Apr 26 '17 15:04 subdan

I have investigated, and there is no clear way to fix this issue. I suggest simply going with the useGutter = true workaround that I suggested.

joshtynjala avatar Jun 14 '17 15:06 joshtynjala