This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 66265d1  jewel validator errortips: fix error tips location when 
controls change its position
66265d1 is described below

commit 66265d1d101e12f68b3b63ea407707500572f46e
Author: Carlos Rovira <[email protected]>
AuthorDate: Mon Feb 18 19:53:39 2019 +0100

    jewel validator errortips: fix error tips location when controls change its 
position
---
 .../apache/royale/jewel/beads/controls/ToolTip.as  |  4 ++--
 .../royale/jewel/beads/validators/Validator.as     | 24 +++++++++++++++++++---
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/ToolTip.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/ToolTip.as
index d8b1c6b..e23dfc5 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/ToolTip.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/ToolTip.as
@@ -156,7 +156,7 @@ package org.apache.royale.jewel.beads.controls
 
                        // add this before measuring or measurement is not 
accurate.
             host.popUpParent.addElement(tt, false); // don't trigger a layout
-            var pt:Point = determinePosition(event, event.target);
+            var pt:Point = determinePosition();
             tt.x = pt.x;
             tt.y = pt.y;
                }
@@ -166,7 +166,7 @@ package org.apache.royale.jewel.beads.controls
                 * Determines the position of the toolTip.
                 * @royaleignorecoercion org.apache.royale.core.IUIBase
                 */
-               protected function determinePosition(event:MouseEvent, 
base:Object):Point
+               protected function determinePosition():Point
                {
                        var ttWidth:Number = tt.width;
                        var ttHeight:Number = tt.height;
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
index e8b5bab..0cf8890 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
@@ -298,9 +298,11 @@ package org.apache.royale.jewel.beads.validators
 
             _errorTip.text = errorText;
 
-                       var pt:Point = determinePosition();
-                       _errorTip.x = pt.x;
-                       _errorTip.y = pt.y;
+                       COMPILE::JS
+                       {
+                       window.addEventListener('resize', repositionHandler, 
false);
+                       repositionHandler();
+                       }
 
                        COMPILE::JS
                        {
@@ -308,8 +310,20 @@ package org.apache.royale.jewel.beads.validators
                                        hostClassList.add("errorBorder");
                        }
                }
+
+               protected function repositionHandler(event:Event = null):void
+               {
+            var pt:Point = determinePosition();
+            _errorTip.x = pt.x;
+            _errorTip.y = pt.y;
+               }
+
                private function removeTip(ev:Event):void
                {
+                       COMPILE::JS
+                       {
+                       window.removeEventListener('resize', repositionHandler, 
false);
+                       }
                        if(_errorTip){
                                _errorTip.parent.removeElement(_errorTip);
                                _errorTip = null;
@@ -370,6 +384,10 @@ package org.apache.royale.jewel.beads.validators
          */
         internal function destroyErrorTip():void
         {
+                       COMPILE::JS
+                       {
+                       window.removeEventListener('resize', repositionHandler, 
false);
+                       }
             if (_errorTip) {
                 _host.popUpParent.removeElement(_errorTip);
                                _errorTip = null;

Reply via email to