Demo Finish
This commit is contained in:
24
Scenes/Viewer.cs
Normal file
24
Scenes/Viewer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Godot;
|
||||
public partial class Viewer : Node2D
|
||||
{
|
||||
private Vector2 Origin => GetParent<CompoundConstructor>().Size / 2;
|
||||
|
||||
public ViewerCamera ViewerCamera { get; private set; }
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
ViewerCamera = GetNode<ViewerCamera>("ViewerCamera");
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseMotion em)
|
||||
if (em.ButtonMask == MouseButtonMask.Middle)
|
||||
Position -= em.Relative;
|
||||
base._Input(@event);
|
||||
}
|
||||
|
||||
public void BackToCenter() => Position = Origin;
|
||||
}
|
||||
Reference in New Issue
Block a user