diff --git a/ovr-utils/addons/openvr_overlay/interaction/overlay_cursor.gd b/ovr-utils/addons/openvr_overlay/interaction/overlay_cursor.gd index 72958d6..98104d5 100644 --- a/ovr-utils/addons/openvr_overlay/interaction/overlay_cursor.gd +++ b/ovr-utils/addons/openvr_overlay/interaction/overlay_cursor.gd @@ -5,6 +5,9 @@ var cursor_node = preload("res://addons/openvr_overlay/interaction/Cursor.tscn" onready var viewport: Viewport = get_node("../../OverlayViewport") onready var _i = get_parent() +var curr_pos: Vector2 +var prev_pos := Vector2(-1000, 1000) + func _ready() -> void: viewport.add_child(cursor_node) get_parent().connect("trigger_on", self, "_trigger_on") @@ -12,7 +15,10 @@ func _ready() -> void: func _process(_delta: float) -> void: + curr_pos = get_canvas_pos() _update_cursor() + _send_move_event() + prev_pos = curr_pos #get canvas position of active controller @@ -24,7 +30,6 @@ func get_canvas_pos() -> Vector2: _i.tracker_nodes[_i.active_controller].translation) var pos = Vector2(controller_local_pos.x, controller_local_pos.y) -# var overlay_size = OverlayInit.ovr_interface.get_render_targetsize() var overlay_size = Vector2(2048, 2048) # scale to pixels pos *= overlay_size.x @@ -39,9 +44,18 @@ func _update_cursor(): cursor_node.rect_position = get_canvas_pos() +func _send_move_event(): + var event = InputEventMouseMotion.new() + event.position = prev_pos + event.relative = curr_pos - prev_pos + event.speed = event.relative + viewport.input(event) + + + func _send_click_event(state: bool): var click_event = InputEventMouseButton.new() - click_event.position = get_canvas_pos() + click_event.position = curr_pos click_event.pressed = state click_event.button_index = 1 viewport.input(click_event) diff --git a/ovr-utils/ui/ListOverlayItem.tscn b/ovr-utils/ui/ListOverlayItem.tscn index 149ea0c..e8eae58 100644 --- a/ovr-utils/ui/ListOverlayItem.tscn +++ b/ovr-utils/ui/ListOverlayItem.tscn @@ -103,12 +103,14 @@ alignment = 2 [node name="Remove" type="Button" parent="MoreOptions/Container/List"] margin_right = 176.0 margin_bottom = 191.0 +focus_mode = 0 icon = ExtResource( 2 ) [node name="SetSize" type="Button" parent="MoreOptions/Container/List"] margin_left = 180.0 margin_right = 356.0 margin_bottom = 191.0 +focus_mode = 0 toggle_mode = true icon = ExtResource( 4 ) @@ -139,6 +141,7 @@ __meta__ = { margin_left = 360.0 margin_right = 536.0 margin_bottom = 191.0 +focus_mode = 0 toggle_mode = true icon = ExtResource( 12 ) @@ -157,7 +160,8 @@ margin_left = 8.0 margin_top = 8.0 margin_right = 168.0 margin_bottom = 441.0 -min_value = 0.2 +focus_mode = 0 +min_value = 0.3 max_value = 1.0 step = 0.05 value = 1.0 @@ -169,6 +173,7 @@ __meta__ = { margin_left = 540.0 margin_right = 720.0 margin_bottom = 191.0 +focus_mode = 0 text = "Left" icon = ExtResource( 6 ) clip_text = true @@ -179,12 +184,14 @@ selected = 1 margin_left = 724.0 margin_right = 900.0 margin_bottom = 191.0 +focus_mode = 0 icon = ExtResource( 5 ) [node name="CloseOptions" type="Button" parent="MoreOptions/Container/List"] margin_left = 904.0 margin_right = 1080.0 margin_bottom = 191.0 +focus_mode = 0 icon = ExtResource( 11 ) [connection signal="toggled" from="BasicOptions/List/Grab" to="." method="_on_Grab_toggled"]