From e55df98e9d3e8f221af0ef931105f414957a5ea0 Mon Sep 17 00:00:00 2001 From: Justin K Date: Tue, 3 Nov 2020 20:45:02 +0100 Subject: [PATCH 1/3] Dont draw the panel when its 3d --- cl_ui3d2d_extras.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cl_ui3d2d_extras.lua b/cl_ui3d2d_extras.lua index 5c4c18e..1a2d79f 100644 --- a/cl_ui3d2d_extras.lua +++ b/cl_ui3d2d_extras.lua @@ -96,10 +96,12 @@ do --3d2d VGUI Drawing checkHover(panel, cursorX, cursorY) end + panel:SetPaintedManually(false) panel:PaintManual() + panel:SetPaintedManually(true) gui.MouseX, gui.MouseY = oldMouseX, oldMouseY ui3d2d.endDraw() end -end \ No newline at end of file +end From c8161d9a738f3355398adc271ca2cea39c009d3c Mon Sep 17 00:00:00 2001 From: Justin K Date: Tue, 3 Nov 2020 21:04:32 +0100 Subject: [PATCH 2/3] Actually simulate a mouse press when possible Fallback to DoClick just in case --- cl_ui3d2d_extras.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cl_ui3d2d_extras.lua b/cl_ui3d2d_extras.lua index 1a2d79f..58607f5 100644 --- a/cl_ui3d2d_extras.lua +++ b/cl_ui3d2d_extras.lua @@ -65,7 +65,21 @@ do --3d2d VGUI Drawing else if not validChild and pointInsidePanel(panel, x, y) then panel.Hovered = true - if panel.DoClick and ui3d2d.isPressed() then panel:DoClick() end + + if panel.OnMousePressed then + local key = input.IsKeyDown(KEY_LSHIFT) and MOUSE_RIGHT or MOUSE_LEFT + + if panel.OnMousePressed and ui3d2d.isPressed() then + panel:OnMousePressed(key) + end + + if panel.OnMouseReleased and not ui3d2d.isPressing() then + panel:OnMouseReleased(key) + end + elseif panel.DoClick and ui3d2d.isPressed() then + panel:DoClick() + end + if panel.OnCursorEntered then panel:OnCursorEntered() end return true From b5f89501c55f420b7fdd96083f70900e4a05ae73 Mon Sep 17 00:00:00 2001 From: Justin K Date: Tue, 3 Nov 2020 21:15:50 +0100 Subject: [PATCH 3/3] Tom didnt liked that so i changed it a bit --- cl_ui3d2d_extras.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cl_ui3d2d_extras.lua b/cl_ui3d2d_extras.lua index 58607f5..441bebd 100644 --- a/cl_ui3d2d_extras.lua +++ b/cl_ui3d2d_extras.lua @@ -54,6 +54,7 @@ do --3d2d VGUI Drawing return s.Hovered end + panel:SetPaintedManually(true) panel.isUi3d2dSetup = true end @@ -110,9 +111,7 @@ do --3d2d VGUI Drawing checkHover(panel, cursorX, cursorY) end - panel:SetPaintedManually(false) panel:PaintManual() - panel:SetPaintedManually(true) gui.MouseX, gui.MouseY = oldMouseX, oldMouseY