Skip to content

Commit eed7094

Browse files
committed
prevent property context menu from going off screen
happens often with model bodygroups and other such properties at the very bottom of long property lists
1 parent a608a72 commit eed7094

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lua/pac3/editor/client/panels/properties.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,13 @@ do -- base editable
20252025
menu:SetPos(input.GetCursorPos())
20262026
menu:MakePopup()
20272027
self:PopulateContextMenu(menu)
2028+
pac.RunNextFrameSimple(function()
2029+
local x,y = input.GetCursorPos()
2030+
local w,h = menu:GetCanvas():GetParent():GetSize()
2031+
if ScrH() < y + h then
2032+
menu:SetPos(x, ScrH() - h)
2033+
end
2034+
end)
20282035
end
20292036
end
20302037

@@ -3358,6 +3365,7 @@ do -- boolean
33583365
chck.DoRightClick = function()
33593366
local menu = DermaMenu()
33603367
menu:SetPos(input.GetCursorPos())
3368+
menu:MakePopup()
33613369
if self.user_proxies then
33623370
for _,part in pairs(self.user_proxies) do
33633371
menu:AddOption("jump to " .. tostring(part), function()
@@ -3485,7 +3493,13 @@ do -- boolean
34853493
self.OnValueChanged(val)
34863494
end
34873495
end):SetImage(pace.MiscIcons.clear)
3488-
menu:MakePopup()
3496+
pac.RunNextFrameSimple(function()
3497+
local x,y = input.GetCursorPos()
3498+
local w,h = menu:GetCanvas():GetParent():GetSize()
3499+
if ScrH() < y + h then
3500+
menu:SetPos(x, ScrH() - h)
3501+
end
3502+
end)
34893503
end
34903504
self.chck = chck
34913505

0 commit comments

Comments
 (0)