fix font color in canvsa
This commit is contained in:
@@ -87,8 +87,8 @@ class CanvasContext2D:
|
|||||||
}
|
}
|
||||||
canvas._add_draw_command(cmd)
|
canvas._add_draw_command(cmd)
|
||||||
|
|
||||||
func drawText(x: float, y: float, text: String, color_hex: String = "#000000"):
|
func drawText(x: float, y: float, text: String, color_hex: String = ""):
|
||||||
var color = _parse_color(fill_style if color_hex == "#000000" else color_hex)
|
var color = _parse_color(fill_style if color_hex.is_empty() else color_hex)
|
||||||
var cmd = {
|
var cmd = {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"x": x,
|
"x": x,
|
||||||
|
|||||||
@@ -314,13 +314,10 @@ static func _2d_drawText_wrapper(vm: LuauVM) -> int:
|
|||||||
var x: float = vm.luaL_checknumber(2)
|
var x: float = vm.luaL_checknumber(2)
|
||||||
var y: float = vm.luaL_checknumber(3)
|
var y: float = vm.luaL_checknumber(3)
|
||||||
var text: String = vm.luaL_checkstring(4)
|
var text: String = vm.luaL_checkstring(4)
|
||||||
var font_name: String = "default"
|
|
||||||
var color: String = "#000000"
|
var color: String = "#000000"
|
||||||
|
|
||||||
if vm.lua_gettop() >= 5:
|
if vm.lua_gettop() >= 5:
|
||||||
font_name = vm.luaL_checkstring(5)
|
color = vm.luaL_checkstring(5)
|
||||||
if vm.lua_gettop() >= 6:
|
|
||||||
color = vm.luaL_checkstring(6)
|
|
||||||
|
|
||||||
vm.lua_getfield(1, "_element_id")
|
vm.lua_getfield(1, "_element_id")
|
||||||
var element_id: String = vm.lua_tostring(-1)
|
var element_id: String = vm.lua_tostring(-1)
|
||||||
@@ -332,7 +329,6 @@ static func _2d_drawText_wrapper(vm: LuauVM) -> int:
|
|||||||
"x": x,
|
"x": x,
|
||||||
"y": y,
|
"y": y,
|
||||||
"text": text,
|
"text": text,
|
||||||
"font_name": font_name,
|
|
||||||
"color": color
|
"color": color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user