You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/07/29 02:30:11 UTC

[royale-asjs] branch develop updated: fixes #860 (in simple testing)

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

gregdove 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 7ed67bdda4 fixes #860 (in simple testing)
7ed67bdda4 is described below

commit 7ed67bdda47d3ce39780c9ad1a8d8bc5a1cb9bc8
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Jul 29 14:29:58 2022 +1200

    fixes #860 (in simple testing)
---
 .../MXRoyale/src/main/resources/defaults.css       | 10 ++++
 .../MXRoyale/src/main/royale/mx/controls/HRule.as  | 69 +++++++++++++++++++++-
 .../MXRoyale/src/main/royale/mx/controls/VRule.as  | 38 +++++++++---
 3 files changed, 107 insertions(+), 10 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 8aafb41356..60693cfd17 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -324,6 +324,11 @@ containerBeads|PanelInternalContainer
 	IBeadView: ClassReference("mx.containers.beads.PanelInternalContainerView");
 }
 
+HRule {
+	stroke-width: 2px;
+	stroke-color: #C4CCCC
+}
+
 Image
 {
 	IBeadModel: ClassReference("org.apache.royale.html.beads.models.ImageModel");
@@ -666,6 +671,11 @@ ViewStack
 	IViewport: ClassReference("org.apache.royale.html.supportClasses.Viewport");
 }
 
+VRule {
+	stroke-width: 2px;
+	stroke-color: #C4CCCC
+}
+
 charts|ChartBase
 {
 	dataTipRenderer : ClassReference("mx.charts.chartClasses.DataTip");           
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/HRule.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/HRule.as
index d8e6f4e9ca..8d5cfd0f27 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/HRule.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/HRule.as
@@ -175,22 +175,85 @@ public class HRule extends UIComponent
         super();
     }
 
+   // private var _strokeWidth:int = 2;
+    public function get strokeWidth():int
+    {
+        return uint(getStyle('strokeWidth'));
+    }
+    public function set strokeWidth(value:int):void
+    {
+        //_strokeWidth = value;
+        setStyle('strokeWidth', value);
+        if (parent) {
+            updateStyle();
+        }
+    }
+
+  //  private var _strokeColor:uint = 0xC4CCCC;
+    public function get strokeColor():uint
+    {
+        return uint(getStyle('strokeColor'));
+    }
+    public function set strokeColor(value:uint):void
+    {
+        setStyle('strokeColor', value);
+        if (parent) {
+            updateStyle();
+        }
+    }
+
+    override public function addedToParent():void
+    {
+        updateStyle()
+        super.addedToParent();
+    }
+
+
+
+    private function updateStyle():void{
+        var values:Object = {
+            styleList : { "borderTopStyle" : 1,
+                "borderTopWidth" : 1,
+                "borderTopColor" : 1 },
+            "borderTopWidth" : strokeWidth.toString() + "px",
+            "borderTopStyle" : "solid",
+            "borderTopColor" : "#" +('00000' +strokeColor.toString(16)).substr(-6)
+        }
+
+        var currentStyle:Object = style;
+        if (currentStyle) {
+            for (var field:String in values) {
+                currentStyle[field] = values[field];
+            }
+        } else currentStyle = values;
+        style = currentStyle;
+    }
     //--------------------------------------------------------------------------
     //
-    //  Overridden methods: UIComponent
+    //  Overridden methods
     //
     //--------------------------------------------------------------------------
 
+    override public function get measuredWidth():Number
+    {
+        return DEFAULT_PREFERRED_WIDTH;
+    }
+    override public function get measuredHeight():Number
+    {
+        return strokeWidth;
+    }
+
+
     /**
      *  @private
      */
-    override protected function measure():void
+    /*override protected function measure():void
     {
         super.measure();
 
         measuredWidth = DEFAULT_PREFERRED_WIDTH;
         measuredHeight = getStyle("strokeWidth");
-    }
+    }*/
     
     /**
      *  @private
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/VRule.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/VRule.as
index 4ac5b6fd06..da0cfe1425 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/VRule.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/VRule.as
@@ -179,26 +179,51 @@ public class VRule extends UIComponent
         super();
     }
 
-    private var _strokeWidth:int = 1;
+   // private var _strokeWidth:int = 2;
     public function get strokeWidth():int
     {
-        return _strokeWidth;
+        return uint(getStyle('strokeWidth'));
     }
     public function set strokeWidth(value:int):void
     {
-        _strokeWidth = value;
+        //_strokeWidth = value;
+        setStyle('strokeWidth', value);
+        if (parent) {
+            updateStyle();
+        }
+    }
+
+  //  private var _strokeColor:uint = 0xC4CCCC;
+    public function get strokeColor():uint
+    {
+        return uint(getStyle('strokeColor'));
+    }
+    public function set strokeColor(value:uint):void
+    {
+        setStyle('strokeColor', value);
+        if (parent) {
+            updateStyle();
+        }
     }
     
     override public function addedToParent():void
     {
+        updateStyle()
+        super.addedToParent();
+    }
+
+
+
+    private function updateStyle():void{
         var values:Object = {
             styleList : { "borderLeftStyle" : 1,
-                          "borderLeftWidth" : 1,
-                          "borderLeftColor" : 1 },
+                "borderLeftWidth" : 1,
+                "borderLeftColor" : 1 },
             "borderLeftWidth" : strokeWidth.toString() + "px",
             "borderLeftStyle" : "solid",
-            "borderLeftColor" : "#000"
+            "borderLeftColor" : "#" +('00000' +strokeColor.toString(16)).substr(-6)
         }
+
         var currentStyle:Object = style;
         if (currentStyle) {
             for (var field:String in values) {
@@ -206,7 +231,6 @@ public class VRule extends UIComponent
             }
         } else currentStyle = values;
         style = currentStyle;
-        super.addedToParent();
     }
     //--------------------------------------------------------------------------
     //