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/23 06:52:44 UTC

[royale-asjs] 06/09: no default stroke

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 8a5f51d7c16858a17310bf6dabe23ddeb21175c4
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Dec 22 22:08:05 2019 -0800

    no default stroke
---
 .../src/main/royale/mx/display/Graphics.as         | 54 +++++++++++++---------
 1 file changed, 33 insertions(+), 21 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/display/Graphics.as b/frameworks/projects/MXRoyale/src/main/royale/mx/display/Graphics.as
index 7caee4f..842564e 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/display/Graphics.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/display/Graphics.as
@@ -181,7 +181,7 @@ package mx.display
 		{
 		} 
 		
-        private var thickness:Number = 0.5;
+        private var thickness:Number = NaN;
         private var color:uint = 0;
         private var alpha:Number = 1.0;
         
@@ -254,11 +254,14 @@ package mx.display
             {
                 var path:SVGElement = document.createElementNS("http://www.w3.org/2000/svg", "ellipse") as SVGElement;
                 var colorString:String = "RGB(" + (color >> 16) + "," + ((color & 0xff00) >> 8) + "," + (color & 0xff) + ")";
-                path.setAttribute("stroke", colorString);
-                var widthString:String = thickness.toString();
-                path.setAttribute("stroke-width", widthString);
-                if (alpha != 1)
-                    path.setAttribute("stroke-opacity", alpha.toString());
+                if (!isNaN(thickness))
+                {
+                    path.setAttribute("stroke", colorString);
+                    var widthString:String = thickness.toString();
+                    path.setAttribute("stroke-width", widthString);
+                    if (alpha != 1)
+                        path.setAttribute("stroke-opacity", alpha.toString());
+                }
                 colorString = "RGB(" + (fillColor >> 16) + "," + ((fillColor & 0xff00) >> 8) + "," + (fillColor & 0xff) + ")";
                 path.setAttribute("fill", colorString);
                 if (fillAlpha != 1)
@@ -285,11 +288,14 @@ package mx.display
             {
                 var path:SVGElement = document.createElementNS("http://www.w3.org/2000/svg", "rect") as SVGElement;
                 var colorString:String = "RGB(" + (color >> 16) + "," + ((color & 0xff00) >> 8) + "," + (color & 0xff) + ")";
-                path.setAttribute("stroke", colorString);
-                var widthString:String = thickness.toString();
-                path.setAttribute("stroke-width", widthString);
-                if (alpha != 1)
-                    path.setAttribute("stroke-opacity", alpha.toString());
+                if (!isNaN(thickness))
+                {
+                    path.setAttribute("stroke", colorString);
+                    var widthString:String = thickness.toString();
+                    path.setAttribute("stroke-width", widthString);
+                    if (alpha != 1)
+                        path.setAttribute("stroke-opacity", alpha.toString());
+                }
                 colorString = "RGB(" + (fillColor >> 16) + "," + ((fillColor & 0xff00) >> 8) + "," + (fillColor & 0xff) + ")";
                 path.setAttribute("fill", colorString);
                 if (fillAlpha != 1)
@@ -321,11 +327,14 @@ package mx.display
             {
                 var path:SVGElement = document.createElementNS("http://www.w3.org/2000/svg", "rect") as SVGElement;
                 var colorString:String = "RGB(" + (color >> 16) + "," + ((color & 0xff00) >> 8) + "," + (color & 0xff) + ")";
-                path.setAttribute("stroke", colorString);
-                var widthString:String = thickness.toString();
-                path.setAttribute("stroke-width", widthString);
-                if (alpha != 1)
-                    path.setAttribute("stroke-opacity", alpha.toString());
+                if (!isNaN(thickness))
+                {
+                    path.setAttribute("stroke", colorString);
+                    var widthString:String = thickness.toString();
+                    path.setAttribute("stroke-width", widthString);
+                    if (alpha != 1)
+                        path.setAttribute("stroke-opacity", alpha.toString());
+                }
                 colorString = "RGB(" + (fillColor >> 16) + "," + ((fillColor & 0xff00) >> 8) + "," + (fillColor & 0xff) + ")";
                 path.setAttribute("fill", colorString);
                 if (fillAlpha != 1)
@@ -352,11 +361,14 @@ package mx.display
             {
                 var path:SVGElement = document.createElementNS("http://www.w3.org/2000/svg", "circle") as SVGElement;
                 var colorString:String = "RGB(" + (color >> 16) + "," + ((color & 0xff00) >> 8) + "," + (color & 0xff) + ")";
-                path.setAttribute("stroke", colorString);
-                var widthString:String = thickness.toString();
-                path.setAttribute("stroke-width", widthString);
-                if (alpha != 1)
-                    path.setAttribute("stroke-opacity", alpha.toString());
+                if (!isNaN(thickness))
+                {
+                    path.setAttribute("stroke", colorString);
+                    var widthString:String = thickness.toString();
+                    path.setAttribute("stroke-width", widthString);
+                    if (alpha != 1)
+                        path.setAttribute("stroke-opacity", alpha.toString());
+                }
                 colorString = "RGB(" + (fillColor >> 16) + "," + ((fillColor & 0xff00) >> 8) + "," + (fillColor & 0xff) + ")";
                 path.setAttribute("fill", colorString);
                 if (fillAlpha != 1)