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/11/23 07:39:32 UTC

[royale-asjs] 01/02: special case height/width in states

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 7628fb6071634646344a74f5fde8f50509dd26de
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Nov 22 23:34:54 2020 -0800

    special case height/width in states
---
 .../royale/core/StatesWithTransitionsImpl.as       | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as b/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
index 041ff67..587435a 100644
--- a/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
+++ b/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
@@ -65,6 +65,19 @@ package org.apache.royale.core
         private var _strand:IStrand;
         
         private var sawInitComplete:Boolean;
+
+	    /**
+	     *  @private
+	     *  This is a table of pseudonyms.
+	     *  Whenever the property being overridden is found in this table,
+	     *  the pseudonym is saved/restored instead.
+	     */
+	    private static const PSEUDONYMS:Object =
+	    {
+	        width: "explicitWidth",
+	        height: "explicitHeight",
+	        currentState: "currentStateDeferred"
+	    };
         
         /**
          *  @copy org.apache.royale.core.IBead#strand
@@ -262,10 +275,11 @@ package org.apache.royale.core
                 else if (o is SetProperty)
                 {
                     var sp:SetProperty = SetProperty(o);
+					var propName:String = PSEUDONYMS[sp.name] || sp.name;
                     if (sp.target != null)
-                        sp.document[sp.target][sp.name] = sp.previousValue;
+                        sp.document[sp.target][propName] = sp.previousValue;
                     else
-                        sp.document[sp.name] = sp.previousValue;
+                        sp.document[propName] = sp.previousValue;
                 }
                 else if (o is SetEventHandler)
                 {
@@ -359,15 +373,16 @@ package org.apache.royale.core
                 else if (o is SetProperty)
                 {
                     var sp:SetProperty = SetProperty(o);
+					var propName:String = PSEUDONYMS[sp.name] || sp.name;
                     if (sp.target != null)
                     {
-                        sp.previousValue = sp.document[sp.target][sp.name];
-                        sp.document[sp.target][sp.name] = sp.value;
+                        sp.previousValue = sp.document[sp.target][propName];
+                        sp.document[sp.target][propName] = sp.value;
                     }
                     else
                     {
-                        sp.previousValue = sp.document[sp.name];
-                        sp.document[sp.name] = sp.value;                        
+                        sp.previousValue = sp.document[propName];
+                        sp.document[propName] = sp.value;                        
                     }
                 }
                 else if (o is SetEventHandler)