drag and drop UI
This commit is contained in:
27
Meeting.cs
27
Meeting.cs
@@ -37,12 +37,6 @@ public partial class Meeting : RigidBody2D
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_isDragging && @event is InputEventMouseButton { Pressed: false })
|
||||
{
|
||||
GD.Print("Let me free");
|
||||
StopDragging();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
@@ -65,15 +59,18 @@ public partial class Meeting : RigidBody2D
|
||||
|
||||
private void StartDragging()
|
||||
{
|
||||
Freeze = true;
|
||||
_isDragging = true;
|
||||
CollisionLayer = 0;
|
||||
}
|
||||
LinearVelocity = Vector2.Zero;
|
||||
AngularVelocity = 0;
|
||||
RotationDegrees = 0;
|
||||
|
||||
private void StopDragging()
|
||||
{
|
||||
Freeze = false;
|
||||
_isDragging = false;
|
||||
CollisionLayer = 1;
|
||||
var meetingControl = Instantiator.Instantiate<MeetingControl>();
|
||||
meetingControl.Meeting = this;
|
||||
|
||||
GetParent().AddChild(meetingControl);
|
||||
meetingControl.StartDrag();
|
||||
|
||||
meetingControl.Position = new Vector2(-5000, -5000);
|
||||
|
||||
GetParent().RemoveChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user