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 1ec99967c869c7552aabba1d2cb2b221cbc3d60d..ca180df4e9780fc5993c68a15c5c71e362e98f60 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 a28ece13fb4f79e189a9172b6fda573d2185d029..f84eab711b330a534d424f8ebae069317f5e2cc1 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];
                                }
                        }