Raster: reversed rects (min>max) draw like upstream

This commit is contained in:
4DBug committed 2026-10-17 06:08:08 -05:00
1 parent 357ef22e40
commit d2c5b61660
7 files changed
+110 -2

No files matched your search

+1 -1
View File
@@ -1 +1 @@
[[46, "imgui.lua"], [22648, "imgui_demo.lua"], [34505, "imgui_draw.lua"], [42829, "imgui_h.lua"], [45832, "roblox/raster.lua"], [46308, "roblox/textures.lua"], [46479, "roblox/layers.lua"], [46816, "roblox/overlays.lua"], [46897, "roblox/render.lua"], [47742, "roblox/parallel.lua"], [48141, "imgui_impl_roblox.lua"], [48630, "imgui_impl_roblox_fonts.lua"], [55033, "imgui_internal.lua"], [58999, "imgui_tables.lua"], [64091, "imgui_widgets.lua"], [76329, "imstb_rectpack.lua"], [76993, "imstb_textedit.lua"], [78535, "imstb_truetype.lua"], [81323, "imstd_minstdio.lua"]]
[[46, "imgui.lua"], [22648, "imgui_demo.lua"], [34505, "imgui_draw.lua"], [42835, "imgui_h.lua"], [45838, "roblox/raster.lua"], [46314, "roblox/textures.lua"], [46485, "roblox/layers.lua"], [46822, "roblox/overlays.lua"], [46903, "roblox/render.lua"], [47748, "roblox/parallel.lua"], [48147, "imgui_impl_roblox.lua"], [48636, "imgui_impl_roblox_fonts.lua"], [55039, "imgui_internal.lua"], [59005, "imgui_tables.lua"], [64097, "imgui_widgets.lua"], [76335, "imstb_rectpack.lua"], [76999, "imstb_textedit.lua"], [78541, "imstb_truetype.lua"], [81329, "imstd_minstdio.lua"]]
+6
View File
@@ -40649,6 +40649,10 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
return
end
-- [Port] reversed corners (min > max, e.g. a box selection dragged up/left): upstream's min_dim checks drop them, older ImGui drew them
if p_min.x > p_max.x or p_min.y > p_max.y then
p_min, p_max = ImVec2(ImMin(p_min.x, p_max.x), ImMin(p_min.y, p_max.y)), ImVec2(ImMax(p_min.x, p_max.x), ImMax(p_min.y, p_max.y))
end
flags = bit32.bor(flags, self.Flags)
local stroke_pos = _GetStrokePos(flags, 131072 --[[ImDrawFlags.StrokeInside]])
if stroke_pos == 917504 --[[ImDrawFlags.StrokeLegacy]] then
@@ -40866,6 +40870,8 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags)
end
local ax, ay, bx, by = p_min.x, p_min.y, p_max.x, p_max.y
if ax > bx then ax, bx = bx, ax end -- [Port] reversed corners: see AddRect
if ay > by then ay, by = by, ay end
local width = bx - ax
local height = by - ay
local min_dim = ImMin(width, height)
+1 -1
View File
@@ -1 +1 @@
[[183, "imgui.lua"], [22785, "imgui_demo.lua"], [34642, "imgui_draw.lua"], [42966, "imgui_h.lua"], [45967, "imgui_impl_love.lua"], [46511, "imgui_internal.lua"], [50477, "imgui_tables.lua"], [55569, "imgui_widgets.lua"], [67807, "imstb_rectpack.lua"], [68471, "imstb_textedit.lua"], [70013, "imstb_truetype.lua"], [72801, "imstd_minstdio.lua"]]
[[183, "imgui.lua"], [22785, "imgui_demo.lua"], [34642, "imgui_draw.lua"], [42972, "imgui_h.lua"], [45973, "imgui_impl_love.lua"], [46517, "imgui_internal.lua"], [50483, "imgui_tables.lua"], [55575, "imgui_widgets.lua"], [67813, "imstb_rectpack.lua"], [68477, "imstb_textedit.lua"], [70019, "imstb_truetype.lua"], [72807, "imstd_minstdio.lua"]]
+6
View File
@@ -40786,6 +40786,10 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
return
end
-- [Port] reversed corners (min > max, e.g. a box selection dragged up/left): upstream's min_dim checks drop them, older ImGui drew them
if p_min.x > p_max.x or p_min.y > p_max.y then
p_min, p_max = ImVec2(ImMin(p_min.x, p_max.x), ImMin(p_min.y, p_max.y)), ImVec2(ImMax(p_min.x, p_max.x), ImMax(p_min.y, p_max.y))
end
flags = bit32.bor(flags, self.Flags)
local stroke_pos = _GetStrokePos(flags, 131072 --[[ImDrawFlags.StrokeInside]])
if stroke_pos == 917504 --[[ImDrawFlags.StrokeLegacy]] then
@@ -41003,6 +41007,8 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags)
end
local ax, ay, bx, by = p_min.x, p_min.y, p_max.x, p_max.y
if ax > bx then ax, bx = bx, ax end -- [Port] reversed corners: see AddRect
if ay > by then ay, by = by, ay end
local width = bx - ax
local height = by - ay
local min_dim = ImMin(width, height)