Skip to main content
Participant
August 29, 2011
Question

Incorrect bounding rectangle height after styling

  • August 29, 2011
  • 1 reply
  • 775 views

I am experiencing with incorrect bounding rectangle height when I set the background color for text in RichEditableText field. I have actually custom styled the RET field with following:

lineHeight: 49;

baselineShift: 11;

firstBaselineOffset: lineHeight;

verticalAlign: top;

When I try to change the background color for certain range of text it doesn't cover the entire line height, although the selection covers the entire line height. Is there any way to increase the height of bounding rectangle or any other workaround to this please?

This topic has been closed for replies.

1 reply

Adobe Employee
August 30, 2011

Firstly, I believe there is a bug when baselineShift is set. TLF should draw background according to the baseline shift, rather than draw on the TextLine. The area for background now is exactly the returend bounds of the Textline. TextLine is a class in the runtime provided by player, not by TLF. I am not sure it's a player bug or by design.

Now TLF draw span's background based on the bounding rectangles of TextLines in flashx.textLayout.elements.BackgroundManager, as what you have seen. So if you want to draw background as the selection, you need to overwrite it.

For some simple case, for example, drawing background for a paragraph, you can get the related TextLines on the stage and compute the areas on your own. And you can get more info by accessing TextFlowLine, which can be get through TextLine.userData.

ZishanJAuthor
Participant
September 18, 2011

Hi,

After your last message, I was trying to implement the highlighter as per your suggestions. I am almost successful in implementing it but I get into some other following issues:

1. I am able to return the TextFlowLine for each line in para but I have seen that some TextLine are marked as INVALID due to which I am unable to get their atom locations. I have tried to force the validity of TextLine to recreate the line but that doesn't work for some lines. Is there any work around to this?

2. The highlighter rectangle which I have created, have tried to placed it as a child element of TextLine. Due to this, the highlighter rectangle appear infront of the TextLine. I have tried to positioned it at 0 location using addChildAt but that doesn't seems to work. Is there any work around to this also please?

Thanks for your helpful answers

Adobe Employee
September 19, 2011

1. I am able to return the TextFlowLine for each line in para but I have seen that some TextLine are marked as INVALID due to which I am unable to get their atom locations. I have tried to force the validity of TextLine to recreate the line but that doesn't work for some lines. Is there any work around to this?

When the contents of the TextBlock are modified, the Flash runtime marks affected text lines, the previous line, and all following lines as INVALID. So I think you may want to get the lines

[When you try to override TLF source code] after ContainerController.updateCompositionShapes 

[When you just take advantage of offical TLF library] in the event handler of UpdateCompleteEvent.UPDATE_COMPLETE.

2. The highlighter rectangle which I have created, have tried to placed it as a child element of TextLine. Due to this, the highlighter rectangle appear infront of the TextLine. I have tried to positioned it at 0 location using addChildAt but that doesn't seems to work. Is there any work around to this also please?

In TLF code, we creat Shape as the child of the container to draw the selection, because TextLine is transparent.