You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/KevServer/WebDrawViewOperator.cs

66 lines
1.7 KiB
C#

using GeoSigmaDrawLib;
using System.Drawing;
using System.Windows.Forms;
namespace KevServer
{
public class WebDrawViewOperator
{
public GeoSigmaXY Geo
{
get; set;
} = null;
private ViewOperationKind kind = ViewOperationKind.Invalid;
private Point ptStart;
private Point ptLast;
/// <summary>
/// 类型
/// </summary>
public ViewOperationKind Kind
{
get
{
return kind;
}
set
{
this.kind = value;
ptStart.X = ptStart.Y = 0;
// SetViewWindow
Geo?.SetViewOperationKind(kind); // TODO:重命名SetViewPan
}
}
/// <summary>
/// Initializes a new instance of the <see cref="WebDrawViewOperator"/> class.
/// </summary>
/// <param name="geo">The geo.</param>
public WebDrawViewOperator(GeoSigmaXY geo)
{
this.Geo = geo;
}
public void OnLButtonDown(MouseEventArgs e)
{
ptStart = new Point(e.X, e.Y);
ptLast = new Point(e.X, e.Y);
if (this.kind == ViewOperationKind.ViewPan)
{
Geo.ViewMouseDown(e.X, e.Y);
}
else
{
Geo.ViewMouseDown(e.X, e.Y);
}
}
public bool OnLButtonUp(MouseEventArgs e)
{
ptLast = new Point(e.X, e.Y);
if (ptLast.X - ptStart.X > 0 || ptLast.Y - ptStart.Y != 0)
{
Geo.ViewMouseUp(e.X, e.Y);
return true;
}
return false;
}
}
}