how to disable dragging popup?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By WellStacked

how to disable dragging popup?
I did not find in the manual how to do it

:bust_in_silhouette: Reply From: TheFamousRat

Hello WellStacked,

I looked into the doc and didn’t see any built-in way to do it either.
A hacky but working way to do it is just to register the coordinates the popup had when it was created, and to reset them to that every time the user tries to move the popup.

Something like this :

var initialPos : Vector2

func _ready():
	initialPos = self.get_position()

func _input(event):
	if event is InputEventMouseMotion:
		self.set_position(initialPos)

Kinda hacky, but should work.

Hope this helps

Thx! But, can limit the edges? so that he does not go beyond the edges of the screen?

WellStacked | 2019-02-05 20:39

Do you want to disable dragging altogether, or just make it so that the user can’t drag it out of the screen ?

TheFamousRat | 2019-02-06 02:16

Disable dragging altogether.
By the way, I was able to do this by installing on AcceptDialog > Mouse > Filter > Ignore
It seems to work, but I do not know if this is correct)

WellStacked | 2019-02-06 02:57

:bust_in_silhouette: Reply From: Hamion

You click on the popup, go to the inspector and go to the control section.
Then you search for mouse, and change the filter to ignore. No more dragging but clicks still work.

Popup > Inspector > Control > Mouse > Filter = Ignore