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; /// /// 类型 /// public ViewOperationKind Kind { get { return kind; } set { this.kind = value; ptStart.X = ptStart.Y = 0; // SetViewWindow Geo?.SetViewOperationKind(kind); // TODO:重命名SetViewPan } } /// /// Initializes a new instance of the class. /// /// The geo. 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; } } }