View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002430 | NoesisGUI | Unreal | public | 2022-09-23 13:07 | 2022-11-15 16:55 |
| Reporter | sfernandez | Assigned To | hcpizzi | ||
| Priority | normal | Severity | major | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.1.5 | ||||
| Target Version | 3.1.6 | Fixed in Version | 3.1.6 | ||
| Summary | 0002430: Noesis widget blocks input for other UMG widgets or actor mouse over events | ||||
| Description | Related to forum posts: The current implementation blocks input because Noesis widget is changing default Visibility to Visible and the widget geometry covers the entire screen. | ||||
| Platform | Any | ||||
|
Hi, We've found a way to overcome this issue. I've attached a patch with our solution. It requires setting the Visibility in the NoesisView to SelfHitTestInvisible or "Not Hit-Testable (Self Only)" as is displayed in the editor. With these changes NoesisViews should behave like UMG Widgets with respect to the Visibility property: Visible means inputs are blocked, even in areas with no background. We've also made the change to make SelfHitTestInvisible the default Visibility value for NoesisViews. This is what UMG does, and the only reason we defaulted fo Visible was because otherwise we wouldn't get any input events. Please, try this patch and let us know if this fixes the issue. HittestFix.patch (4,229 bytes)
Index: Classes/NoesisInstance.h
===================================================================
--- Classes/NoesisInstance.h (revision 11572)
+++ Classes/NoesisInstance.h (working copy)
@@ -134,6 +134,8 @@
typedef TSharedPtr<class FNoesisSlateElement, ESPMode::ThreadSafe> FNoesisSlateElementPtr;
FNoesisSlateElementPtr NoesisSlateElement;
+ TSharedPtr<class FHittestGrid> HittestGrid;
+
UPROPERTY()
class UNoesisXaml* BaseXaml;
@@ -181,7 +183,7 @@
void OnPreviewGotKeyboardFocus(Noesis::BaseComponent* Component, const Noesis::KeyboardFocusChangedEventArgs& Args);
void OnPreviewLostKeyboardFocus(Noesis::BaseComponent* Component, const Noesis::KeyboardFocusChangedEventArgs& Args);
- bool HitTest(FVector2D Position);
+ bool HitTest(FVector2D Position) const;
void TermInstance();
@@ -191,8 +193,9 @@
virtual void PostLoad();
// End of UObject interface
+ // UWidget interface
+ virtual void OnWidgetRebuilt() override;
#if WITH_EDITOR
- // UWidget interface
virtual void SetDesignerFlags(EWidgetDesignFlags NewFlags) override;
// End of UWidget interface
Index: Private/NoesisInstance.cpp
===================================================================
--- Private/NoesisInstance.cpp (revision 11572)
+++ Private/NoesisInstance.cpp (working copy)
@@ -26,6 +26,9 @@
#include "Widgets/SWindow.h"
#include "Framework/Application/SlateApplication.h"
+// SlateCore includes
+#include "Input/HitTestGrid.h"
+
// NoesisRuntime includes
#include "NoesisCustomVersion.h"
#include "NoesisRuntimeModule.h"
@@ -269,9 +272,8 @@
}
UNoesisInstance::UNoesisInstance(const FObjectInitializer& ObjectInitializer)
- : Super(ObjectInitializer), Scene(nullptr)
+ : Super(ObjectInitializer), Scene(nullptr), HittestGrid(MakeShared<FHittestGrid>())
{
- Visibility = ESlateVisibility::Visible;
}
void UNoesisInstance::InitInstance()
@@ -554,7 +556,7 @@
Noesis::UIElement* Hit;
};
-bool UNoesisInstance::HitTest(FVector2D Position)
+bool UNoesisInstance::HitTest(FVector2D Position) const
{
NoesisHitTestVisibleTester HitTester;
@@ -641,6 +643,13 @@
#endif
}
+void UNoesisInstance::OnWidgetRebuilt()
+{
+ Super::OnWidgetRebuilt();
+
+ HittestGrid = MakeShared<FHittestGrid>();
+}
+
#if WITH_EDITOR
void UNoesisInstance::SetDesignerFlags(EWidgetDesignFlags NewFlags)
{
@@ -725,6 +734,46 @@
{
int32 MaxLayer = Super::NativePaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
+ if (GetVisibility() == ESlateVisibility::SelfHitTestInvisible)
+ {
+ TSharedPtr<ICursor> PlatformCursor = FSlateApplication::Get().GetPlatformCursor();
+ auto ScreenSpacePosition = PlatformCursor->GetPosition() - Args.GetWindowToDesktopTransform();
+ FVector2D Position = AllottedGeometry.AbsoluteToLocal(ScreenSpacePosition) * AllottedGeometry.Scale;
+ bool Hit = HitTest(Position);
+
+ if (Hit)
+ {
+ auto PinnedWidget = MyWidget.Pin();
+ if (PinnedWidget.IsValid())
+ {
+ auto WidgetVisibility = PinnedWidget->GetVisibility();
+ PinnedWidget->SetVisibility(EVisibility::Visible);
+#if UE_VERSION_OLDER_THAN(5, 0, 0)
+ HittestGrid->AddWidget(PinnedWidget.ToSharedRef(), 0, LayerId, FSlateInvalidationWidgetSortOrder());
+#else
+ HittestGrid->AddWidget(PinnedWidget.Get(), 0, LayerId, FSlateInvalidationWidgetSortOrder());
+#endif
+ PinnedWidget->SetVisibility(WidgetVisibility);
+
+ auto& RootHittestGrid = Args.GetHittestGrid();
+ HittestGrid->SetHittestArea(RootHittestGrid.GetGridOrigin(), RootHittestGrid.GetGridSize(), RootHittestGrid.GetGridWindowOrigin());
+ HittestGrid->SetCullingRect(MyCullingRect);
+ HittestGrid->SetOwner(PinnedWidget.Get());
+ RootHittestGrid.AddGrid(HittestGrid.ToSharedRef());
+ }
+ }
+ else
+ {
+ auto& RootHittestGrid = Args.GetHittestGrid();
+ RootHittestGrid.RemoveGrid(HittestGrid.ToSharedRef());
+ }
+ }
+ else
+ {
+ auto& RootHittestGrid = Args.GetHittestGrid();
+ RootHittestGrid.RemoveGrid(HittestGrid.ToSharedRef());
+ }
+
if (XamlView)
{
Noesis::Ptr<Noesis::IRenderer> Renderer(XamlView->GetRenderer());
|
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2022-09-23 13:07 | sfernandez | New Issue | |
| 2022-09-23 13:07 | sfernandez | Assigned To | => hcpizzi |
| 2022-09-23 13:07 | sfernandez | Status | new => assigned |
| 2022-09-23 13:07 | sfernandez | Target Version | => 3.1.6 |
| 2022-09-23 14:57 | hcpizzi | Note Added: 0008083 | |
| 2022-09-23 14:57 | hcpizzi | File Added: HittestFix.patch | |
| 2022-09-23 14:57 | hcpizzi | Status | assigned => feedback |
| 2022-11-07 17:13 | sfernandez | Target Version | 3.1.6 => 3.1.7 |
| 2022-11-07 17:52 | sfernandez | Target Version | 3.1.7 => 3.1.6 |
| 2022-11-15 16:55 | jsantos | Status | feedback => resolved |
| 2022-11-15 16:55 | jsantos | Resolution | open => fixed |
| 2022-11-15 16:55 | jsantos | Fixed in Version | => 3.1.6 |