Skip to content

Commit

Permalink
Fix issues with polygon and polyline
Browse files Browse the repository at this point in the history
  • Loading branch information
MewPurPur committed Oct 11, 2024
1 parent 3bafd1a commit 0c5ff4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/data_classes/DB.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const recognized_attributes = { # Dictionary{String: Array[String]}
"line": ["transform", "opacity", "stroke", "stroke-opacity", "stroke-width",
"stroke-linecap", "x1", "y1", "x2", "y2"],
"polygon": ["transform", "opacity", "fill", "fill-opacity", "stroke", "stroke-opacity",
"stroke-width", "stroke-linecap", "stroke-linejoin", "points"],
"stroke-width", "stroke-linejoin", "points"],
"polyline": ["transform", "opacity", "fill", "fill-opacity", "stroke",
"stroke-opacity", "stroke-width", "stroke-linecap", "stroke-linejoin", "points"],
"stop": ["offset", "stop-color", "stop-opacity"],
Expand Down
3 changes: 2 additions & 1 deletion src/data_classes/ElementPolygon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const possible_conversions = ["path", "rect"]

func user_setup(pos := Vector2.ZERO) -> void:
if pos != Vector2.ZERO:
set_attribute("points", "0 0")
var attrib: AttributeList = get_attribute("points")
attrib.set_points(PackedVector2Array([pos]))

func _get_own_default(attribute_name: String) -> String:
if attribute_name == "opacity":
Expand Down
3 changes: 2 additions & 1 deletion src/data_classes/ElementPolyline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const possible_conversions = ["path", "line"]

func user_setup(pos := Vector2.ZERO) -> void:
if pos != Vector2.ZERO:
set_attribute("points", "0 0")
var attrib: AttributeList = get_attribute("points")
attrib.set_points(PackedVector2Array([pos]))
set_attribute("fill", "none")
set_attribute("stroke", "black")

Expand Down

0 comments on commit 0c5ff4f

Please sign in to comment.