Fix broken style-merging behaviour
authorRichard Fairhurst <richard@systemeD.net>
Wed, 7 Mar 2012 20:59:55 +0000 (20:59 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Wed, 7 Mar 2012 20:59:55 +0000 (20:59 +0000)
net/systemeD/halcyon/styleparser/ShapeStyle.as
net/systemeD/halcyon/styleparser/Style.as

index 1ec9996..ca180df 100644 (file)
@@ -4,7 +4,7 @@ package net.systemeD.halcyon.styleparser {
        
        public class ShapeStyle extends Style {
 
-               public var width:Number=0;
+               public var width:Number;
                public var color:Number;
                public var opacity:Number;
                public var dashes:Array=[];
@@ -32,7 +32,7 @@ package net.systemeD.halcyon.styleparser {
                }
                
                override public function get drawn():Boolean {
-                       return (fill_image || !isNaN(fill_color) || width || casing_width);
+                       return (fill_image || !isNaN(fill_color) || !isNaN(width) || casing_width);
                }
 
                public function applyStrokeStyle(g:Graphics):void {
index a28ece1..f84eab7 100644 (file)
@@ -56,7 +56,7 @@ package net.systemeD.halcyon.styleparser {
                public function mergeWith(additional:Style):void {
                        for each (var prop:String in properties) {
                                // Note extra check for empty arrays, which we use to mean 'undefined' (see setPropertyFromString below)
-                               if (additional[prop] != undefined && !((additional[prop] is Array) && additional[prop].length==0)) {
+                               if (additional[prop]!=undefined && !((additional[prop] is Number) && isNaN(additional[prop])) && !((additional[prop] is Array) && additional[prop].length==0)) {
                                        this[prop]=additional[prop];
                                }
                        }