Rev 1427 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BurutaruEditor.interaction
{
public class Panning : Interaction
{
private bool mRightDown = false;
private int mLastX = 0;
private int mLastY = 0;
public Panning(MainForm owner)
: base(owner)
{
}
public override void MouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
mRightDown = true;
}
mLastX = e.X;
mLastY = e.Y;
}
public override void MouseMove(MouseEventArgs e)
{
if (mRightDown)
{
float dx = e.X - mLastX;
float dy = e.Y - mLastY;
Owner.View.Pan(dx, dy);
}
mLastX = e.X;
mLastY = e.Y;
}
public override void MouseUp(MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
mRightDown = false;
}
}
public override void Render()
{
}
}
}