fix font color in canvsa

This commit is contained in:
Face
2025-09-11 18:04:15 +03:00
parent 3962a878e3
commit faa3561b37
2 changed files with 3 additions and 7 deletions

View File

@@ -87,8 +87,8 @@ class CanvasContext2D:
}
canvas._add_draw_command(cmd)
func drawText(x: float, y: float, text: String, color_hex: String = "#000000"):
var color = _parse_color(fill_style if color_hex == "#000000" else color_hex)
func drawText(x: float, y: float, text: String, color_hex: String = ""):
var color = _parse_color(fill_style if color_hex.is_empty() else color_hex)
var cmd = {
"type": "text",
"x": x,

View File

@@ -314,13 +314,10 @@ static func _2d_drawText_wrapper(vm: LuauVM) -> int:
var x: float = vm.luaL_checknumber(2)
var y: float = vm.luaL_checknumber(3)
var text: String = vm.luaL_checkstring(4)
var font_name: String = "default"
var color: String = "#000000"
if vm.lua_gettop() >= 5:
font_name = vm.luaL_checkstring(5)
if vm.lua_gettop() >= 6:
color = vm.luaL_checkstring(6)
color = vm.luaL_checkstring(5)
vm.lua_getfield(1, "_element_id")
var element_id: String = vm.lua_tostring(-1)
@@ -332,7 +329,6 @@ static func _2d_drawText_wrapper(vm: LuauVM) -> int:
"x": x,
"y": y,
"text": text,
"font_name": font_name,
"color": color
}