Click or drag to resize
Ab4d.SharpEngine logo

ManualInputEventsManager Class

ManualInputEventsManager class simplifies working with pointer and mouse events on 3D objects. Because this class is cross-platform, it cannot subscribe to platform specific events. This is done in special InputEventsManager classes that are implemented for WPF, Avalonia, WinUI and WinForms. The following events can be subscribed on 3D objects: PointerPressed, PointerReleased, PointerClicked, PointerDoubleClicked, PointerWheelChanged, PointerEntered, PointerExited, PointerMoved, BeginPointerDrag, PointerDrag and EndPointerDrag events. To register for those events, create an instance ModelNodeEventsSource, NamedModelNodesEventsSource, NamedModelNodesEventsSource or created your own class that is derived from InputEventsSource. ManualInputEventsManager also provides a generic PointerEntered, PointerExited, PointerPressed, PointerReleased and PointerMoved events that can be used to be notified when a button is pressed or released over the SceneView or when pointer or mouse is moved.
Inheritance Hierarchy

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public class ManualInputEventsManager

The ManualInputEventsManager type exposes the following members.

Constructors
 NameDescription
Public methodManualInputEventsManager Constructor
Top
Properties
 NameDescription
Public propertyDoubleClickTimeout Gets or sets a time in milliseconds from the first click to the second click to be considered as double click. Default value is 300 ms.
Public propertyDragPointerButtons Gets or sets buttons that are used for dragging. Default value is Left.
Public propertyDragPointerDistance Gets or sets the distance pointer must make when the move is considered as a drag. The default value is 5.
Public propertyIsDragging True when a ModelNode is currently being dragged.
Public propertyIsEnabled Gets or sets a boolean value that specifies if the EventManager3D is enabled.
Public propertySceneView Gets the SceneView that contains the SceneNode objects that are used by this ManualInputEventsManager.
Public propertyTriggerEnterLeaveEventsOnEachSceneNodeChange Gets or sets a Boolean that specifies if Enter and Leave events are triggered on each change of the SceneNode (when true). When false, then Enter and Leave events are triggered only when InputEventSource object is changed (for example, when using MultiModelNodesEventsSource then Leave and Enter events will not be triggered when pointer is moved from one to another SceneNode that are all registered by the same MultiModelNodesEventsSource). Default value is true.
Top
Methods
 NameDescription
Public methodCapturePointer CaptureMouse method captures the pointer or mouse events so that even if mouse is moved out of the active window, the mouse events are passed to the active window. This method must be overriden by a derived class to provide any functionality. To end the capture, call the EndPointerCapture method.
Public methodEndPointerCapture EndPointerCapture end the pointer or mouse capture that was started by calling the CapturePointer method. This method must be overriden by a derived class to provide any functionality.
Protected methodOnEventSourceMouseWheel OnEventSourceMouseWheel
Protected methodOnEventSourcePointerBeginDrag OnEventSourcePointerBeginDrag
Protected methodOnEventSourcePointerClick OnEventSourcePointerClick
Protected methodOnEventSourcePointerDoubleClick OnEventSourcePointerDoubleClick
Protected methodOnEventSourcePointerDown OnEventSourcePointerDown
Protected methodOnEventSourcePointerEndDrag OnEventSourcePointerEndDrag
Protected methodOnEventSourcePointerEnter OnEventSourcePointerEnter
Protected methodOnEventSourcePointerLeave OnEventSourcePointerLeave
Protected methodOnEventSourcePointerMove OnEventSourcePointerMove
Protected methodOnEventSourcePointerUp OnEventSourcePointerUp
Protected methodOnPointerEntered OnPointerEntered
Protected methodOnPointerExited OnPointerExited
Protected methodOnPointerMoved OnPointerMoved
Protected methodOnPointerPressed OnPointerPressed
Protected methodOnPointerReleased OnPointerReleased
Public methodProcessPointerEntered ProcessPointerEntered method processes the pointer enter event.
Public methodProcessPointerExited ProcessPointerExited method processes the pointer exited event.
Public methodProcessPointerMoved ProcessPointerMoved method processes the pointer move event and returns true if the event is handled by this method.
Protected methodProcessPointerPositionChanged ProcessPointerPositionChanged is used to handle pointer move.
Public methodProcessPointerPressed ProcessPointerPressed method processes the button pressed event and returns true if the event is handled by this method.
Public methodProcessPointerReleased ProcessMouseReleased method processes the pointer released event and returns true if the event is handled by this method.
Public methodProcessPointerWheelChanged PointerWheelChanged method processes the pointer wheel event and returns true if the event is handled by this method.
Public methodRegisterDragSurface(IListModelNode) Registers the ModelNodes in the specified list to be used as drag surface so that BeginPointerDrag, PointerDrag and EndPointerDrag events can be subscribed on event source objects.
Public methodRegisterDragSurface(ModelNode) Registers the specified dragSurfaceModelNode to be used as drag surface so that BeginPointerDrag, PointerDrag and EndPointerDrag events can be subscribed on event source objects.
Public methodRegisterDragSurface(ModelNode) Registers the specified ModelNode objects to be used as drag surface so that BeginPointerDrag, PointerDrag and EndPointerDrag events can be subscribed on event source objects.
Public methodRegisterDragSurface(Vector3, Vector3) Registers a plane as a drag surface. The method returns an index of the registered plane that can be used to remove the plane by calling RemoveDragSurface(Int32).
Public methodRegisterEventsSource Registers the eventsSource to this ManualInputEventsManager
Public methodRegisterExcludedSceneNode Registers a SceneNode that will be excluded from hit testing. If sceneNode is a GroupNode, then all child SceneNodes are also excluded.
Public methodRegisterExcludedSceneNodes(IListSceneNode) Registers a list of SceneNode objects that will be excluded from hit testing. If SceneNode is a GroupNode, then all child SceneNodes are also excluded.
Public methodRegisterExcludedSceneNodes(SceneNode) Registers a list of SceneNode objects that will be excluded from hit testing. If SceneNode is a GroupNode, then all child SceneNodes are also excluded.
Public methodRemoveAllDragSurfaces Removes all registered drag surfaces.
Public methodRemoveDragSurface(IListModelNode) Removes the specified ModelNodes in the specified list as the drag surface.
Public methodRemoveDragSurface(Int32) Removes the drag plane that was registered by calling RegisterDragSurface(Vector3, Vector3) (the dragSurfacePlaneIndex was returned by that method).
Public methodRemoveDragSurface(ModelNode) Removes the specified ModelNode as the drag surface.
Public methodRemoveDragSurface(ModelNode) Removes the specified ModelNode objects as the drag surface.
Public methodRemoveEventsSource Removes the eventsSource from the ManualInputEventsManager
Public methodRemoveExcludedSceneNode Removed the sceneNode from the excluded visuals list. To remove all excluded visuals it is also possible to call ResetEventSources method.
Public methodRemoveExcludedSceneNodes Removed the sceneNodes from the excluded visuals list. To remove all excluded visuals it is also possible to call ResetEventSources method.
Public methodResetEventSources Clears all the registered EventsSource objects.
Public methodUpdateHitObjects UpdateHitObjects method can be called to manually update the 3D objects that are behind the current mouse position. This is useful when the camera is changed without moving the mouse. In this case the 3D objects behind the mouse position can change. If this happens the MouseEnter, MouseLeave and other event handlers will be called from the UpdateHitObjects method.
Protected methodUpdateLastHitObject UpdateLastHitObject method sets protected lastHitEventSource, lastHitSceneNode and lastRayHitResult with the hit event source data.
Top
Events
 NameDescription
Public eventPointerEntered PointerEntered is triggered when the pointer or mouse entered the SceneView.
Public eventPointerExited PointerExited is triggered when the pointer or mouse left the SceneView.
Public eventPointerMoved PointerMoved is triggered when the pointer or mouse was moved.
Public eventPointerPressed PointerPressed is triggered when the pointer or mouse button was pressed.
Public eventPointerReleased PointerReleased is triggered when the pointer or mouse button was released.
Top
Fields
 NameDescription
Protected fielddragSurfaceModelNodes dragSurfaceModelNodes
Protected fielddragSurfacePlanes dragSurfacePlanes
Protected fieldeventsSources eventsSources
Protected fieldexcludedSceneNodes excludedSceneNodes
Protected fieldlastHitEventSource Last hit EventSource
Protected fieldlastHitSceneNode lastHitSceneNode
Protected fieldlastRayHitResult RayHitTestResult of the last hit EventSource
Top
Remarks

ManualInputEventsManager class simplifies working with pointer and mouse events on 3D objects. Because this class is cross-platform, it cannot subscribe to platform specific events. This is done in special InputEventsManager classes that are implemented for WPF, Avalonia, WinUI and WinForms.

The following events can be subscribed on 3D objects: PointerPressed, PointerReleased, PointerClicked, PointerDoubleClicked, PointerWheelChanged, PointerEntered, PointerExited, PointerMoved, BeginPointerDrag, PointerDrag and EndPointerDrag events.

To register for those events, create an instance ModelNodeEventsSource, NamedModelNodesEventsSource, NamedModelNodesEventsSource or created your own class that is derived from InputEventsSource.

ManualInputEventsManager also provides a generic PointerEntered, PointerExited, PointerPressed, PointerReleased and PointerMoved events that can be used to be notified when a button is pressed or released over the SceneView or when pointer or mouse is moved.

See Also