Skip to content

Commit fe04297

Browse files
committed
Interactivity: add StopPropagation=true to click events
1 parent 0f03b21 commit fe04297

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

Editor/Scripts/Interactivity/VisualScriptingExport/UnitExporters/Events/GameObjectEvents.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public Type unitType
1616
get => typeof(TVisualGraphUnit);
1717
}
1818

19+
protected virtual bool StopPropagationDefault => false;
20+
1921
protected virtual string NodeIndexId => Event_OnSelectNode.IdValueSelectedNodeIndex;
2022
protected virtual string HitLocationId => Event_OnSelectNode.IdValueLocalHitLocation;
2123
protected virtual string ControllerIndexId => Event_OnSelectNode.IdValueControllerIndex;
@@ -56,7 +58,7 @@ public bool InitializeInteractivityNodes(UnitExporter unitExporter)
5658
// Config for stop propagation will just default to False. We don't have an equivalent
5759
// parameter in Unity Visual Scripting so we will default to preventing the selection
5860
// event from being propagated up the hierarchy.
59-
node.Configuration["stopPropagation"].Value = false;
61+
node.Configuration["stopPropagation"].Value = StopPropagationDefault;
6062

6163
node.FlowOut("out").MapToControlOutput(triggerOutput);
6264

Editor/Scripts/Interactivity/VisualScriptingExport/UnitExporters/Events/OnPointerClickEventExport.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace UnityGLTF.Interactivity.VisualScripting.Export
66
{
77
public class OnPointerClickEventExport : GameObjectEvents<OnPointerClick, Event_OnSelectNode>
88
{
9+
protected override bool StopPropagationDefault
10+
{
11+
get => true;
12+
}
13+
914
[InitializeOnLoadMethod]
1015
private static void Register()
1116
{

Editor/Scripts/Interactivity/VisualScriptingExport/UnitExporters/Events/OnSelectMouseUpEventExport.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ namespace UnityGLTF.Interactivity.VisualScripting.Export
66
{
77
public class OnSelectMouseUpEventExport : GameObjectEvents<OnMouseUp, Event_OnSelectNode>
88
{
9+
protected override bool StopPropagationDefault
10+
{
11+
get => true;
12+
}
913

1014
[InitializeOnLoadMethod]
1115
private static void Register()

0 commit comments

Comments
 (0)