diff --git a/Nodify/Connections/BaseConnection.cs b/Nodify/Connections/BaseConnection.cs
index 785060d6..97a39bc8 100644
--- a/Nodify/Connections/BaseConnection.cs
+++ b/Nodify/Connections/BaseConnection.cs
@@ -803,12 +803,12 @@ public void StopAnimation()
///
protected override void OnMouseDown(MouseButtonEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseUp(MouseButtonEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released
if (IsMouseCaptured && e.RightButton == MouseButtonState.Released && e.LeftButton == MouseButtonState.Released && e.MiddleButton == MouseButtonState.Released)
@@ -819,20 +819,20 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
///
protected override void OnMouseMove(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseWheel(MouseWheelEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnLostMouseCapture(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnKeyUp(KeyEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released
if (IsMouseCaptured && Mouse.RightButton == MouseButtonState.Released && Mouse.LeftButton == MouseButtonState.Released && Mouse.MiddleButton == MouseButtonState.Released)
@@ -843,7 +843,7 @@ protected override void OnKeyUp(KeyEventArgs e)
///
protected override void OnKeyDown(KeyEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
#endregion
diff --git a/Nodify/Connectors/Connector.cs b/Nodify/Connectors/Connector.cs
index cb4da2a1..4cf19df1 100644
--- a/Nodify/Connectors/Connector.cs
+++ b/Nodify/Connectors/Connector.cs
@@ -332,12 +332,12 @@ public void UpdateAnchor()
///
protected override void OnMouseDown(MouseButtonEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseUp(MouseButtonEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && e.RightButton == MouseButtonState.Released && e.LeftButton == MouseButtonState.Released && e.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -348,20 +348,20 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
///
protected override void OnMouseMove(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseWheel(MouseWheelEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnLostMouseCapture(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnKeyUp(KeyEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && Mouse.RightButton == MouseButtonState.Released && Mouse.LeftButton == MouseButtonState.Released && Mouse.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -372,7 +372,7 @@ protected override void OnKeyUp(KeyEventArgs e)
///
protected override void OnKeyDown(KeyEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
/// Determines whether any toggled interaction is currently in progress.
diff --git a/Nodify/Containers/ItemContainer.cs b/Nodify/Containers/ItemContainer.cs
index 34e566da..5b3e7a01 100644
--- a/Nodify/Containers/ItemContainer.cs
+++ b/Nodify/Containers/ItemContainer.cs
@@ -369,12 +369,12 @@ public void Select(SelectionType type)
///
protected override void OnMouseDown(MouseButtonEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseUp(MouseButtonEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && e.RightButton == MouseButtonState.Released && e.LeftButton == MouseButtonState.Released && e.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -385,20 +385,20 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
///
protected override void OnMouseMove(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnMouseWheel(MouseWheelEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnLostMouseCapture(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnKeyUp(KeyEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && Mouse.RightButton == MouseButtonState.Released && Mouse.LeftButton == MouseButtonState.Released && Mouse.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -409,7 +409,7 @@ protected override void OnKeyUp(KeyEventArgs e)
///
protected override void OnKeyDown(KeyEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
/// Determines whether any toggled interaction is currently in progress.
diff --git a/Nodify/Editor/NodifyEditor.Panning.cs b/Nodify/Editor/NodifyEditor.Panning.cs
index 474f9ba6..68a3665c 100644
--- a/Nodify/Editor/NodifyEditor.Panning.cs
+++ b/Nodify/Editor/NodifyEditor.Panning.cs
@@ -193,7 +193,7 @@ private void HandleAutoPanning(object? sender, EventArgs e)
_autoPanningEventArgs.Handled = false;
_autoPanningEventArgs.Source = this;
- InputProcessor.Process(_autoPanningEventArgs);
+ InputProcessor.ProcessEvent(_autoPanningEventArgs);
}
}
diff --git a/Nodify/Editor/NodifyEditor.cs b/Nodify/Editor/NodifyEditor.cs
index 4f6f8c06..b1f32b32 100644
--- a/Nodify/Editor/NodifyEditor.cs
+++ b/Nodify/Editor/NodifyEditor.cs
@@ -798,14 +798,14 @@ protected void OnRemoveConnection(object? dataContext)
protected override void OnMouseDown(MouseButtonEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnMouseUp(MouseButtonEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && e.RightButton == MouseButtonState.Released && e.LeftButton == MouseButtonState.Released && e.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -818,24 +818,24 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
protected override void OnMouseMove(MouseEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnLostMouseCapture(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnKeyUp(KeyEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && Mouse.RightButton == MouseButtonState.Released && Mouse.LeftButton == MouseButtonState.Released && Mouse.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -846,7 +846,7 @@ protected override void OnKeyUp(KeyEventArgs e)
///
protected override void OnKeyDown(KeyEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
/// Determines whether any toggled interaction is currently in progress.
diff --git a/Nodify/Interactivity/DragState.cs b/Nodify/Interactivity/DragState.cs
index ec145030..aa5f5ae1 100644
--- a/Nodify/Interactivity/DragState.cs
+++ b/Nodify/Interactivity/DragState.cs
@@ -199,7 +199,7 @@ private void TryHandleEvent(InputEventArgs e)
private void BeginDrag(InputEventArgs e)
{
// Avoid stealing mouse capture from other elements
- if (Mouse.Captured == null || Element.IsMouseCaptured)
+ if (IsInputCaptured(e))
{
_interactionState = InteractionState.InProgress;
HandleEvent(e); // Handle the event, otherwise CaptureMouse will send a MouseMove event and the current event will be handled out of order
@@ -213,7 +213,7 @@ private void BeginDrag(InputEventArgs e)
}
Element.Focus();
- Element.CaptureMouse();
+ CaptureInput(e);
}
}
@@ -256,6 +256,12 @@ private void CancelDrag(InputEventArgs e)
#endregion
+ protected virtual bool IsInputCaptured(InputEventArgs e)
+ => Mouse.Captured == null || Element.IsMouseCaptured;
+
+ protected virtual void CaptureInput(InputEventArgs e)
+ => Element.CaptureMouse();
+
protected virtual bool IsInputCaptureLost(InputEventArgs e)
{
return e.RoutedEvent == UIElement.LostMouseCaptureEvent;
diff --git a/Nodify/Interactivity/InputProcessor.Shared.cs b/Nodify/Interactivity/InputProcessor.Shared.cs
index 949bf9bd..d9ce10b5 100644
--- a/Nodify/Interactivity/InputProcessor.Shared.cs
+++ b/Nodify/Interactivity/InputProcessor.Shared.cs
@@ -58,7 +58,7 @@ static Shared()
}
public void HandleEvent(InputEventArgs e)
- => Process(e);
+ => ProcessEvent(e);
///
/// Registers a factory method for creating an input handler of the specified type.
diff --git a/Nodify/Interactivity/InputProcessor.cs b/Nodify/Interactivity/InputProcessor.cs
index 1812d665..a7e204e6 100644
--- a/Nodify/Interactivity/InputProcessor.cs
+++ b/Nodify/Interactivity/InputProcessor.cs
@@ -39,7 +39,7 @@ public void Clear()
/// Processes an input event and delegates it to the registered handlers.
///
/// The input event arguments to process.
- public void Process(InputEventArgs e)
+ public void ProcessEvent(InputEventArgs e)
{
if (ProcessHandledEvents)
{
diff --git a/Nodify/Minimap/Minimap.cs b/Nodify/Minimap/Minimap.cs
index 07ddd618..1b8810a6 100644
--- a/Nodify/Minimap/Minimap.cs
+++ b/Nodify/Minimap/Minimap.cs
@@ -149,14 +149,14 @@ protected override bool IsItemItsOwnContainerOverride(object item)
protected override void OnMouseDown(MouseButtonEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnMouseUp(MouseButtonEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && e.RightButton == MouseButtonState.Released && e.LeftButton == MouseButtonState.Released && e.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -169,24 +169,24 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
protected override void OnMouseMove(MouseEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
MouseLocation = e.GetPosition(ItemsHost);
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
}
///
protected override void OnLostMouseCapture(MouseEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
protected override void OnKeyUp(KeyEventArgs e)
{
- InputProcessor.Process(e);
+ InputProcessor.ProcessEvent(e);
// Release the mouse capture if all the mouse buttons are released and there's no interaction in progress
if (IsMouseCaptured && Mouse.RightButton == MouseButtonState.Released && Mouse.LeftButton == MouseButtonState.Released && Mouse.MiddleButton == MouseButtonState.Released && !IsToggledInteractionInProgress())
@@ -197,7 +197,7 @@ protected override void OnKeyUp(KeyEventArgs e)
///
protected override void OnKeyDown(KeyEventArgs e)
- => InputProcessor.Process(e);
+ => InputProcessor.ProcessEvent(e);
///
/// Determines whether any toggled interaction is currently in progress.
diff --git a/Nodify/Nodes/Node.cs b/Nodify/Nodes/Node.cs
index 857865ba..7de14c0f 100644
--- a/Nodify/Nodes/Node.cs
+++ b/Nodify/Nodes/Node.cs
@@ -12,6 +12,9 @@ namespace Nodify
///
[TemplatePart(Name = ElementInputItemsControl, Type = typeof(ItemsControl))]
[TemplatePart(Name = ElementOutputItemsControl, Type = typeof(ItemsControl))]
+ [StyleTypedProperty(Property = nameof(ContentContainerStyle), StyleTargetType = typeof(Border))]
+ [StyleTypedProperty(Property = nameof(HeaderContainerStyle), StyleTargetType = typeof(Border))]
+ [StyleTypedProperty(Property = nameof(FooterContainerStyle), StyleTargetType = typeof(Border))]
public class Node : HeaderedContentControl
{
protected const string ElementInputItemsControl = "PART_Input";