forked from LGDG/ExampleProject
Use _gui_input for header drag
Before this, if you moved a window's header to overlap the game window's header, dragging the window again would drag the window and the game window.
This commit is contained in:
parent
6c7bb284ff
commit
8c8fc8058d
|
@ -38,6 +38,14 @@ func getwinmosposi() -> Vector2i:
|
||||||
return DisplayServer.window_get_position() + Vector2i(floori(mospos.x), floori(mospos.y))
|
return DisplayServer.window_get_position() + Vector2i(floori(mospos.x), floori(mospos.y))
|
||||||
|
|
||||||
func _input(event: InputEvent):
|
func _input(event: InputEvent):
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
if event.is_released():
|
||||||
|
dragging = false
|
||||||
|
elif dragging and event is InputEventMouseMotion:
|
||||||
|
DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi)
|
||||||
|
|
||||||
|
func _gui_input(event: InputEvent):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
if event.double_click:
|
if event.double_click:
|
||||||
|
@ -51,11 +59,6 @@ func _input(event: InputEvent):
|
||||||
dragging = true
|
dragging = true
|
||||||
begwinmosposi = getwinmosposi()
|
begwinmosposi = getwinmosposi()
|
||||||
begwinpos = DisplayServer.window_get_position()
|
begwinpos = DisplayServer.window_get_position()
|
||||||
elif event.is_released():
|
|
||||||
dragging = false
|
|
||||||
elif dragging and event is InputEventMouseMotion:
|
|
||||||
DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi)
|
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_2514r"]
|
[sub_resource type="GDScript" id="GDScript_2514r"]
|
||||||
|
|
Loading…
Reference in New Issue