DragGesture
- class omni.ui.scene.DragGesture
Bases:
ShapeGesture
The gesture that provides a way to capture click-and-drag mouse event.
Methods
__init__
(self, **kwargs)Construct the gesture to track mouse drags.
call_on_began_fn
(self, arg0)Called when the user starts drag.
call_on_changed_fn
(self, arg0)Called when the user is dragging.
call_on_ended_fn
(self, arg0)Called when the user releases the mouse and finishes the drag.
has_on_began_fn
(self)Called when the user starts drag.
has_on_changed_fn
(self)Called when the user is dragging.
has_on_ended_fn
(self)Called when the user releases the mouse and finishes the drag.
set_on_began_fn
(self, fn, None])Called when the user starts drag.
set_on_changed_fn
(self, fn, None])Called when the user is dragging.
set_on_ended_fn
(self, fn, None])Called when the user releases the mouse and finishes the drag.
Attributes
The check_mouse_moved property is a boolean flag that determines whether the DragGesture should verify if the 2D screen position of the mouse has changed before invoking the on_changed method.
The keyboard modifier that should be active ti start the gesture.
Mouse button that should be active to start the gesture.
- __init__(self: omni.ui_scene._scene.DragGesture, **kwargs) None
Construct the gesture to track mouse drags.
- `kwargsdict`
See below
### Keyword Arguments:
- `mouse_button`
Mouse button that should be active to start the gesture.
- `modifiers`
The keyboard modifier that should be active ti start the gesture.
- `check_mouse_moved`
The check_mouse_moved property is a boolean flag that determines whether the DragGesture should verify if the 2D screen position of the mouse has changed before invoking the on_changed method. This property is essential in a 3D environment, as changes in the camera position can result in the mouse pointing to different locations in the 3D world even when the 2D screen position remains unchanged.
Usage When check_mouse_moved is set to True, the DragGesture will only call the on_changed method if the actual 2D screen position of the mouse has changed. This can be useful when you want to ensure that the on_changed method is only triggered when there is a genuine change in the mouse’s 2D screen position. If check_mouse_moved is set to False, the DragGesture will not check for changes in the mouse’s 2D screen position before calling the on_changed method. This can be useful when you want the on_changed method to be invoked even if the mouse’s 2D screen position hasn’t changed, such as when the camera position is altered, and the mouse now points to a different location in the 3D world.
- `on_began_fn`
Called if the callback is not set when the user clicks the mouse button.
- `on_changed_fn`
Called if the callback is not set when the user moves the clicked button.
- `on_ended_fn`
Called if the callback is not set when the user releases the mouse button.
- `name`
The name of the object. It’s used for debugging.
- `manager`
The Manager that controld this gesture.
- call_on_began_fn(self: omni.ui_scene._scene.DragGesture, arg0: omni::ui::scene::AbstractShape) None
Called when the user starts drag.
- call_on_changed_fn(self: omni.ui_scene._scene.DragGesture, arg0: omni::ui::scene::AbstractShape) None
Called when the user is dragging.
- call_on_ended_fn(self: omni.ui_scene._scene.DragGesture, arg0: omni::ui::scene::AbstractShape) None
Called when the user releases the mouse and finishes the drag.
- has_on_began_fn(self: omni.ui_scene._scene.DragGesture) bool
Called when the user starts drag.
- has_on_changed_fn(self: omni.ui_scene._scene.DragGesture) bool
Called when the user is dragging.
- has_on_ended_fn(self: omni.ui_scene._scene.DragGesture) bool
Called when the user releases the mouse and finishes the drag.
- set_on_began_fn(self: omni.ui_scene._scene.DragGesture, fn: Callable[[omni::ui::scene::AbstractShape], None]) None
Called when the user starts drag.
- set_on_changed_fn(self: omni.ui_scene._scene.DragGesture, fn: Callable[[omni::ui::scene::AbstractShape], None]) None
Called when the user is dragging.
- set_on_ended_fn(self: omni.ui_scene._scene.DragGesture, fn: Callable[[omni::ui::scene::AbstractShape], None]) None
Called when the user releases the mouse and finishes the drag.
- property check_mouse_moved
The check_mouse_moved property is a boolean flag that determines whether the DragGesture should verify if the 2D screen position of the mouse has changed before invoking the on_changed method. This property is essential in a 3D environment, as changes in the camera position can result in the mouse pointing to different locations in the 3D world even when the 2D screen position remains unchanged.
Usage When check_mouse_moved is set to True, the DragGesture will only call the on_changed method if the actual 2D screen position of the mouse has changed. This can be useful when you want to ensure that the on_changed method is only triggered when there is a genuine change in the mouse’s 2D screen position. If check_mouse_moved is set to False, the DragGesture will not check for changes in the mouse’s 2D screen position before calling the on_changed method. This can be useful when you want the on_changed method to be invoked even if the mouse’s 2D screen position hasn’t changed, such as when the camera position is altered, and the mouse now points to a different location in the 3D world.
- property modifiers
The keyboard modifier that should be active ti start the gesture.
- property mouse_button
Mouse button that should be active to start the gesture.