flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33791) TextLayoutFramework EditManager.ApplyFormat ignoring selection range
Date Thu, 03 Oct 2013 20:46:43 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13785517#comment-13785517
] 

Jason Taylor commented on FLEX-33791:
-------------------------------------

looks like it's working correctly in the 4.10 SDK and was working incorrectly in previous
versions.

The three parameters for applyFormat are for three different ways the format can be applied.

The first parameter, "leafFormat" will get applied to LeafElement objects like SpanElement
(or nodes, if you prefer to think of the XML that TLF generates) and will actually create
a new leaf if the current (or supplied) SelectionState doesn't encompass an entire LeafElement.

The second parameter, "paragraphFormat" will get applied to the entire paragraph that the
current (or supplied) SelectionState is a part of. So if I select only a few characters from
a paragraph and then call applyFormat, passing in a background color for the "paragraphFormat"
parameter, the entire paragraph will get the background color.

My bad.

> TextLayoutFramework EditManager.ApplyFormat ignoring selection range
> --------------------------------------------------------------------
>
>                 Key: FLEX-33791
>                 URL: https://issues.apache.org/jira/browse/FLEX-33791
>             Project: Apache Flex
>          Issue Type: Bug
>    Affects Versions: Apache Flex 4.10.0
>         Environment: any 4.10 SDK
>            Reporter: Jason Taylor
>            Assignee: Alex Harui
>         Attachments: TLFApplyFormat_SDK4.10.png, TLFApplyFormat_SDK4.9.png
>
>
> when specifiying a text range for format to be applied, format is instead applied to
entire paragraph
> <s:TextArea width="100%" height="100%" id="txt">
>         <s:content>
>             Lorem ipsum dolor sit amet, consectetur adipiscing elit.<s:br/>
>             Nulla sed metus facilisis, elementum arcu a, euismod est.<s:br/>
>             Vivamus quis quam nec sapien accumsan luctus sit amet a magna.<s:br/>
>             Vivamus eu erat ac est ullamcorper egestas eget nec mauris.<s:br/>
>             Cras fringilla leo a risus luctus, eu volutpat diam luctus<s:br/>
>         </s:content>
>     </s:TextArea>
>     <fx:Script><![CDATA[
>         import flashx.textLayout.edit.EditManager;
>         import flashx.textLayout.edit.SelectionState;
>         import flashx.textLayout.elements.TextFlow;
>         import flashx.textLayout.formats.TextLayoutFormat;
>         import mx.events.FlexEvent;
>         private function OnCreationComplete(event:FlexEvent):void
>         {
>             SetRegionColor(txt.textFlow, 5, 6, 0xB9CCFF);
>         }
>         public  function SetRegionColor(objFlow:TextFlow, iStart:int, iEnd:int, iBackgroundColor:*,
nBgAlpha:Number = 1):void
>         {
>             try
>             {
>                 var objFormat:TextLayoutFormat = new TextLayoutFormat();
>                 objFormat.backgroundColor = iBackgroundColor;
>                 objFormat.backgroundAlpha = nBgAlpha;
>                 var objSelection:SelectionState = new SelectionState(objFlow, iStart,
iEnd);
>                 if(objFlow.interactionManager == null || objFlow.interactionManager is
EditManager == true)
>                 {
>                     var objManager:EditManager =  objFlow.interactionManager as EditManager;
>                     objManager.applyFormat(objFormat, objFormat, objFormat, objSelection);
>                 }
>                 else
>                 {
>                     throw new Error("TextFlow is Not Editable");
>                 }
>             }
>             catch(objError:Error)
>             {
>                 trace("DocColorUtils::SetRegionColor Error: " + objError.message, objError);
>             }
>         }
>         ]]></fx:Script>



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message