Added support for blink alpha and blink color for point cursor.
HTML does not have the same transparency support as Flash and control over 
alternating colors is important.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/bde25ebe
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/bde25ebe
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/bde25ebe

Branch: refs/heads/feature/dragAndDrop
Commit: bde25ebea5b88095865050324d8f01073588683f
Parents: d526a4a
Author: Harbs <[email protected]>
Authored: Sun Aug 20 21:39:17 2017 +0300
Committer: Harbs <[email protected]>
Committed: Sun Aug 20 21:39:17 2017 +0300

----------------------------------------------------------------------
 .../textLayout/container/ContainerController.as | 38 ++++++++++++++++++--
 .../flex/textLayout/edit/SelectionFormat.as     | 32 +++++++++++++++--
 2 files changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bde25ebe/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
index 8bf5d07..fc301e2 100644
--- 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
+++ 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
@@ -83,6 +83,7 @@ package org.apache.flex.textLayout.container
        import org.apache.flex.utils.ObjectMap;
        import org.apache.flex.utils.PointUtils;
        import org.apache.flex.utils.Timer;
+       import org.apache.flex.graphics.IDrawable;
 
 
 
@@ -2751,7 +2752,7 @@ package org.apache.flex.textLayout.container
                // TODO Want to evaluate whether there's a cleaner way to do 
this
                
                private var blinkTimer:Timer;
-               private var blinkObject:IUIBase;
+               private var blinkObject:IRect;
                
                /**
                 * Starts a DisplayObject cursor blinking by changing its alpha 
value
@@ -2760,7 +2761,8 @@ package org.apache.flex.textLayout.container
                 * @param obj The DisplayObject to use as the cursor.
                 * 
                 */
-               private function startBlinkingCursor(obj:IUIBase, 
blinkInterval:int):void
+               private  var blinkState:Boolean;
+               private function startBlinkingCursor(obj:IRect, 
blinkInterval:int):void
                {
                        if (!blinkTimer)
                                blinkTimer = new Timer(blinkInterval,0);
@@ -2779,12 +2781,42 @@ package org.apache.flex.textLayout.container
                {
                        if (blinkTimer)
                                blinkTimer.stop();
+                       if(blinkObject)
+                       {
+                               var selFormat:SelectionFormat = 
interactionManager.currentSelectionFormat;
+                               var fill:SolidColor = blinkObject.fill as 
SolidColor;
+                               fill.alpha = selFormat.pointAlpha;
+                               fill.color = selFormat.pointColor;
+                               (blinkObject as IDrawable).draw();
+                               blinkObject.alpha = 1;
+                               blinkState = false;
+                       }
                        blinkObject = null;
                }       
                
                private function blinkTimerHandler(event:Event):void
                {
-                       blinkObject.alpha = (blinkObject.alpha == 1.0) ? 0.0 : 
1.0;
+                       var selFormat:SelectionFormat = 
interactionManager.currentSelectionFormat;
+                       if(selFormat)
+                       {
+                               var fill:SolidColor = blinkObject.fill as 
SolidColor;
+                               if(blinkState)
+                               {
+                                       fill.alpha = selFormat.pointBlinkAlpha;
+                                       fill.color = selFormat.pointBlinkColor;
+                               }
+                               else
+                               {
+                                       fill.alpha = selFormat.pointAlpha;
+                                       fill.color = selFormat.pointColor;
+                               }
+                               (blinkObject as IDrawable).draw();
+                               blinkState = !blinkState;
+                       }
+                       else
+                               blinkObject.alpha = (blinkObject.alpha == 1.0) 
? 0.0 : 1.0;
+                       
+                               
                }
                
                /** 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bde25ebe/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionFormat.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionFormat.as
 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionFormat.as
index a7b4652..bc3392d 100644
--- 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionFormat.as
+++ 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionFormat.as
@@ -38,6 +38,8 @@ package org.apache.flex.textLayout.edit {
                private var _pointAlpha:Number;
                private var _pointBlendMode:String;
                private var _pointBlinkRate:Number;
+               private var _pointBlinkAlpha:Number;
+               private var _pointBlinkColor:uint;
                
                /** 
                 * Creates a SelectionFormat object with the specified 
properties.
@@ -70,7 +72,7 @@ package org.apache.flex.textLayout.edit {
                 * @playerversion AIR 1.5
                 * @langversion 3.0
                 */
-               public function SelectionFormat(rangeColor:uint=0xffffff, 
rangeAlpha:Number=1.0, rangeBlendMode:String="difference", 
pointColor:uint=0xffffff, pointAlpha:Number=1.0, 
pointBlendMode:String="difference", pointBlinkRate:Number = 500)
+               public function SelectionFormat(rangeColor:uint=0xffffff, 
rangeAlpha:Number=1.0, rangeBlendMode:String="difference", 
pointColor:uint=0xffffff, pointAlpha:Number=1.0, 
pointBlendMode:String="difference", pointBlinkRate:Number = 
500,pointBlinkAlpha:Number=0,pointBlinkColor:uint=0)
                { 
                        _rangeColor = rangeColor;
                        _rangeAlpha = rangeAlpha;
@@ -80,6 +82,8 @@ package org.apache.flex.textLayout.edit {
                        _pointAlpha = pointAlpha;
                        _pointBlendMode = pointBlendMode;
                        _pointBlinkRate = pointBlinkRate;
+                       _pointBlinkAlpha = pointBlinkAlpha;
+                       _pointBlinkColor = pointBlinkColor;
                }
                
                /**
@@ -163,7 +167,31 @@ package org.apache.flex.textLayout.edit {
                public function get pointBlinkRate():Number
                {
                        return _pointBlinkRate;
-               }               
+               }
+
+               /**
+                * The alpha of the cursor blinks while blinking.
+                * 
+                * @playerversion Flash 10
+                * @playerversion AIR 1.5
+                * @langversion 3.0
+                */                                             
+               public function get pointBlinkAlpha():Number
+               {
+                       return _pointBlinkAlpha;
+               }
+
+               /**
+                * The color of the cursor while blinking.
+                * 
+                * @playerversion Flash 10
+                * @playerversion AIR 1.5
+                * @langversion 3.0
+                */                                             
+               public function get pointBlinkColor():uint
+               {
+                       return _pointBlinkColor;
+               }
 
                /**
                 * The blend mode for drawing the cursor.

Reply via email to