Rev 1402 |
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 ShapeEditor.interaction
{
public class PanInteraction : InteractionMode
{
private int mLastX = 0;
private int mLastY = 0;
private bool mRightButtonDown = false;
public PanInteraction(MainForm parent)
: base(parent)
{
}
public override void MouseMove(MouseEventArgs e, bool isMouseDown = false)
{
if (e.Button == MouseButtons.Right)
{
if (!mRightButtonDown)
{
// not pressed before - set
mRightButtonDown = true;
}
else
{
// dragging
int deltaX = e.X - mLastX;
int deltaY = e.Y - mLastY;
mParent.PanBy(deltaX, deltaY);
}
}
mLastX = e.X;
mLastY = e.Y;
}
public override void MouseUp(MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
mRightButtonDown = false;
}
}
public override void Render()
{
}
}
}