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 2019/12/08 05:57:27 UTC

[royale-asjs] branch develop updated: improve layout for Spark components

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


The following commit(s) were added to refs/heads/develop by this push:
     new 8af26f7  improve layout for Spark components
8af26f7 is described below

commit 8af26f74e1e567ac47b936937a4072f2c2b19a53
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Dec 7 21:57:02 2019 -0800

    improve layout for Spark components
---
 .../MXRoyale/src/main/royale/mx/core/Container.as    | 14 --------------
 .../MXRoyale/src/main/royale/mx/core/UIComponent.as  | 20 ++++++++++++++++++++
 .../SparkRoyale/src/main/resources/defaults.css      | 11 +++++++++++
 .../src/main/royale/spark/components/Button.as       | 15 ++++++++++++++-
 .../royale/spark/components/SkinnableContainer.as    | 14 ++++++++------
 .../main/royale/spark/components/beads/PanelView.as  |  2 +-
 6 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index 645cff6..58ded37 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -671,20 +671,6 @@ public class Container extends UIComponent
     }
 	[Inspectable(category="General")]
 	
-	/*	  
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get backgroundColor():Object
-    {
-        return ValuesManager.valuesImpl.getValue(this, "backgroundColor");
-    }
-    public function set backgroundColor(value:Object):void
-    {
-        setStyle("backgroundColor", value);
-    }
     
     //----------------------------------
     //  icon
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index f1ea1d3..8494e90 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -2217,6 +2217,8 @@ COMPILE::JS
                     this.positioner.style.width = oldWidth;
                 if (oldLeft.length && oldRight.length) // if both are set, this also dictates width
                     this.positioner.style.left = oldLeft;
+                if (!isNaN(percentWidth))
+                    _measuredMinWidth = mw;
                 return mw;
 			}
 		}
@@ -2289,6 +2291,8 @@ COMPILE::JS
                     this.positioner.style.height = oldHeight;
                 if (oldTop.length && oldBottom.length) // if both are set, this also dictates width
                     this.positioner.style.top = oldTop;
+                if (!isNaN(percentHeight))
+                    _measuredMinHeight = mh;
                 return mh;
             }
 		}
@@ -4918,6 +4922,22 @@ COMPILE::JS
     private var _backgroundAlpha:Number = NaN;
     private var _backgroundColor:String = null;
     
+    /*	  
+    *  @langversion 3.0
+    *  @playerversion Flash 9
+    *  @playerversion AIR 1.1
+    *  @productversion Flex 3
+    */
+    public function get backgroundColor():Object
+    {
+        return ValuesManager.valuesImpl.getValue(this, "backgroundColor");
+    }
+    public function set backgroundColor(value:Object):void
+    {
+        setStyle("backgroundColor", value);
+    }
+
+    
     /**
      *  Sets a style property on this component instance.
      *
diff --git a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
index 97aa1c8..b28ab14 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
@@ -163,6 +163,7 @@ SkinnableContainer
 	IViewport: ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
 	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
 	IContentView: ClassReference("spark.components.Group");
+	border-width: 1px;
 }
 
 TabBar
@@ -197,6 +198,16 @@ TextArea
 	background-color: #FFFFFF;
 }
 
+/* compiler thinks the above TextArea is for HTML TextArea so doesn't convert it to a 
+   class selector */
+.TextArea
+{
+	border-style: solid;
+	border-color: #000000;
+	border-width: 1px;
+	background-color: #FFFFFF;
+}
+
 TitleWindow
 {
 	IBeadView: ClassReference("spark.components.beads.TitleWindowView");
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Button.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Button.as
index 26f11e2..fc566d7 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Button.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Button.as
@@ -20,8 +20,9 @@
 package spark.components
 {
 
-import org.apache.royale.events.Event;
 import spark.components.supportClasses.ButtonBase;
+
+import org.apache.royale.events.Event;
 //import mx.core.IButton;
 
 
@@ -167,7 +168,19 @@ public class Button extends ButtonBase // implements IButton
     //  Overridden methods
     //
     //--------------------------------------------------------------------------
+    override public function get measuredWidth():Number
+    {
+        var mw:Number = super.measuredWidth;
+        if (mw < 70) mw = 70;
+        return mw;
+    }
     
+    override public function get measuredHeight():Number
+    {
+        var mw:Number = super.measuredHeight;
+        if (mw < 21) mw = 21;
+        return mw;
+    }
     
     //--------------------------------------------------------------------------
     //
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
index 64b6b44..a7c8cad 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
@@ -35,6 +35,8 @@ import mx.core.IVisualElement;
 import mx.core.mx_internal;
 
 import spark.components.supportClasses.SkinnableComponent;
+import spark.components.supportClasses.GroupBase;
+import spark.components.beads.SkinnableContainerView;
 import spark.layouts.supportClasses.LayoutBase;
 import spark.layouts.BasicLayout;
 
@@ -443,12 +445,6 @@ public class SkinnableContainer extends SkinnableComponent implements IContainer
 	
 	}
     
-     public function get backgroundColor():uint {
-		return 0;
-
-	}
-	public function set backgroundColor(val:uint):void {
-	}
 	
 	public function get contentBackgroundColor():uint{
 	return 0;
@@ -669,6 +665,8 @@ public class SkinnableContainer extends SkinnableComponent implements IContainer
     
     /**
      * @private
+     * @royaleignorecoercion spark.components.beads.SkinnableContainerView
+     * @royaleignorecoercion spark.components.supportClasses.GroupBase
      */
     public function set layout(value:LayoutBase):void
     {
@@ -683,6 +681,10 @@ public class SkinnableContainer extends SkinnableComponent implements IContainer
             contentGroupProperties.layout = value;
         */
         _layout = value;
+        if (getBeadByType(IBeadView))
+        {
+            ((view as SkinnableContainerView).contentView as GroupBase).layout = value;
+        }
     }
     
     //----------------------------------
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/PanelView.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/PanelView.as
index 56ab2fa..c0f5849 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/PanelView.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/PanelView.as
@@ -132,7 +132,7 @@ class PanelLayout extends LayoutBase
         if (panel.isHeightSizedToContent())
             h = content.height + 2 + titleBar.getExplicitOrMeasuredHeight();
         titleBar.setActualSize(w - 2, titleBar.getExplicitOrMeasuredHeight());
-        content.setActualSize(w - 2, h - titleBar.height - 2);
+        content.setActualSize(w - 2, h - titleBar.height - 2 - 1);
         content.move(0, titleBar.height + 1);
         return false;
     }