@@ -7,7 +7,7 @@ enum NumberRange {ARBITRARY, POSITIVE, UNIT}
77
88
99const _RECOGNIZED_ELEMENTS : PackedStringArray = ["svg" , "g" , "circle" , "ellipse" , "rect" , "path" , "line" , "polyline" , "polygon" ,
10- "stop" , "linearGradient" , "radialGradient" , "use" ]
10+ "stop" , "linearGradient" , "radialGradient" , "use" , "marker" , "clipPath" , "mask" , "image" , "text" , "tspan" ]
1111
1212const _ELEMENT_ICONS : Dictionary [String , Texture2D ] = {
1313 "circle" : preload ("res://assets/icons/element/circle.svg" ),
@@ -22,7 +22,14 @@ const _ELEMENT_ICONS: Dictionary[String, Texture2D] = {
2222 "linearGradient" : preload ("res://assets/icons/element/linearGradient.svg" ),
2323 "radialGradient" : preload ("res://assets/icons/element/radialGradient.svg" ),
2424 "stop" : preload ("res://assets/icons/element/stop.svg" ),
25+ # Not currently in GUI.
2526 "use" : preload ("res://assets/icons/element/use.svg" ),
27+ # "marker": preload("res://assets/icons/element/unrecognized.svg"),
28+ # "clipPath": preload("res://assets/icons/element/unrecognized.svg"),
29+ # "mask": preload("res://assets/icons/element/mask.svg"),
30+ # "image": preload("res://assets/icons/element/image.svg"),
31+ # "text": preload("res://assets/icons/element/text.svg"),
32+ # "tspan": preload("res://assets/icons/element/unrecognized.svg"),
2633}
2734const _UNRECOGNIZED_XNODE_ICON = preload ("res://assets/icons/element/unrecognized.svg" )
2835
@@ -58,12 +65,19 @@ const _RECOGNIZED_ATTRIBUTES: Dictionary[String, Array] = {
5865 "polyline" : ["transform" , "opacity" , "fill" , "fill-opacity" , "stroke" ,
5966 "stroke-opacity" , "stroke-width" , "stroke-linecap" , "stroke-linejoin" , "points" ],
6067 "stop" : ["offset" , "stop-color" , "stop-opacity" ],
61- "use" : ["href" , "transform" , "x" , "y" ]
68+ "use" : ["href" , "transform" , "x" , "y" ],
69+ # "marker": ["id", "markerUnits"],
70+ # "clipPath": ["id", "clipPathUnits"],
71+ # "mask": ["id"],
72+ # "image": ["x", "y", "width", "height", "href"],
73+ # "text": ["x", "y"],
74+ # "tspan": ["x", "y"],
6275}
6376
6477const _VALID_CHILDREN : Dictionary [String , Array ] = {
65- "svg" : ["svg" , "path" , "circle" , "ellipse" , "rect" , "line" , "polygon" , "polyline" , "g" , "linearGradient" , "radialGradient" , "use" ],
66- "g" : ["svg" , "path" , "circle" , "ellipse" , "rect" , "line" , "polygon" , "polyline" , "g" , "linearGradient" , "radialGradient" , "use" ],
78+ "svg" : ["svg" , "path" , "circle" , "ellipse" , "rect" , "line" , "polygon" , "polyline" , "g" , "linearGradient" , "radialGradient" ,
79+ "use" , "marker" , "clipPath" , "mask" , "text" , "tspan" ],
80+ "g" : ["svg" , "path" , "circle" , "ellipse" , "rect" , "line" , "polygon" , "polyline" , "g" , "linearGradient" , "radialGradient" , "use" , "text" , "tspan" ],
6781 "linearGradient" : ["stop" ],
6882 "radialGradient" : ["stop" ],
6983 "circle" : [],
@@ -75,6 +89,12 @@ const _VALID_CHILDREN: Dictionary[String, Array] = {
7589 "polyline" : [],
7690 "stop" : [],
7791 "use" : [],
92+ # "marker": ["path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "g"],
93+ # "clipPath": ["path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "g"],
94+ # "mask": ["path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "g"],
95+ # "image": [],
96+ # "text": ["tspan"],
97+ # "tspan": [],
7898}
7999
80100const PROPAGATED_ATTRIBUTES : PackedStringArray = ["fill" , "fill-opacity" , "stroke" , "stroke-opacity" , "stroke-width" , "stroke-linecap" , "stroke-linejoin" ,
@@ -105,6 +125,8 @@ const _ATTRIBUTE_TYPES: Dictionary[String, AttributeType] = {
105125 "stroke-width" : AttributeType .NUMERIC ,
106126 "stroke-linecap" : AttributeType .ENUM ,
107127 "stroke-linejoin" : AttributeType .ENUM ,
128+ # "stroke-dashoffset": AttributeType.NUMERIC,
129+ # "stroke-dasharray": AttributeType.LIST, # TODO Should be of dasharray type eventually.
108130 "color" : AttributeType .COLOR ,
109131 "d" : AttributeType .PATHDATA ,
110132 "points" : AttributeType .LIST ,
@@ -117,13 +139,17 @@ const _ATTRIBUTE_TYPES: Dictionary[String, AttributeType] = {
117139 "gradientUnits" : AttributeType .ENUM ,
118140 "spreadMethod" : AttributeType .ENUM ,
119141 "href" : AttributeType .HREF ,
142+ # "markerUnits": AttributeType.ENUM,
143+ # "clipPathUnits": AttributeType.ENUM,
120144}
121145
122146const ATTRIBUTE_ENUM_VALUES : Dictionary [String , Array ] = {
123147 "stroke-linecap" : ["butt" , "round" , "square" ],
124148 "stroke-linejoin" : ["miter" , "round" , "bevel" ],
125149 "gradientUnits" : ["userSpaceOnUse" , "objectBoundingBox" ],
126150 "spreadMethod" : ["pad" , "reflect" , "repeat" ],
151+ # "markerUnits": ["userSpaceOnUse", "strokeWidth"],
152+ # "clipPathUnits": ["userSpaceOnUse", "objectBoundingBox"],
127153}
128154
129155const ATTRIBUTE_NUMBER_RANGE : Dictionary [String , NumberRange ] = {
@@ -194,22 +220,9 @@ static func get_attribute_type(attribute_name: String) -> AttributeType:
194220## Get default percentage handling behavior for numeric attributes.
195221static func get_attribute_default_percentage_handling (attribute_name : String ) -> PercentageHandling :
196222 match attribute_name :
197- "width" : return PercentageHandling .HORIZONTAL
198- "height" : return PercentageHandling .VERTICAL
199- "x" : return PercentageHandling .HORIZONTAL
200- "y" : return PercentageHandling .VERTICAL
201- "rx" : return PercentageHandling .HORIZONTAL
202- "ry" : return PercentageHandling .VERTICAL
203- "stroke-width" : return PercentageHandling .NORMALIZED
204- "x1" : return PercentageHandling .HORIZONTAL
205- "y1" : return PercentageHandling .VERTICAL
206- "x2" : return PercentageHandling .HORIZONTAL
207- "y2" : return PercentageHandling .VERTICAL
208- "cx" : return PercentageHandling .HORIZONTAL
209- "cy" : return PercentageHandling .VERTICAL
210- "fx" : return PercentageHandling .HORIZONTAL
211- "fy" : return PercentageHandling .VERTICAL
212- "r" : return PercentageHandling .NORMALIZED
223+ "stroke-width" , "r" : return PercentageHandling .NORMALIZED
224+ "width" , "x" , "rx" , "x1" , "x2" , "cx" , "fx" : return PercentageHandling .HORIZONTAL
225+ "height" , "y" , "ry" , "y1" , "y2" , "cy" , "fy" : return PercentageHandling .VERTICAL
213226 _ : return PercentageHandling .FRACTION
214227
215228## Create an element with initial arbitrary setup values based on that element's user_setup() method.
0 commit comments