You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/03/15 17:20:20 UTC

[royale-asjs] 02/04: only send one event from setWidthAndHeight

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

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

commit d3e27d65344ad27912000e1e3205b96243d8828e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Mar 14 11:16:51 2020 -0700

    only send one event from setWidthAndHeight
---
 .../Basic/src/main/royale/org/apache/royale/core/UIBase.as  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
index 401c3ea..af47753 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
@@ -623,27 +623,30 @@ package org.apache.royale.core
          */
         public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
         {
-            if (_width !== newWidth)
+			var widthChanged:Boolean = _width !== newWidth;
+			var heightChanged:Boolean = _height !== newHeight;
+            if (widthChanged)
             {
                 _width = newWidth;
                 COMPILE::JS
                 {
                     this.positioner.style.width = newWidth.toString() + 'px';        
                 }
-                if (!noEvent) 
+                if (!noEvent && !heightChanged) 
                     sendEvent(this,"widthChanged");
             }
-            if (_height !== newHeight)
+            if (heightChanged)
             {
                 _height = newHeight;
                 COMPILE::JS
                 {
                     this.positioner.style.height = newHeight.toString() + 'px';        
                 }
-                if (!noEvent)
+                if (!noEvent && !widthChanged)
                     sendEvent(this,"heightChanged");
             }            
-            sendEvent(this,"sizeChanged");
+			if (widthChanged && heightChanged)
+	            sendEvent(this,"sizeChanged");
         }
         
         /**