Example #1
0
		public override void PointerMove(ToolEventArgs e)
		{
            if (e.Location == base.LastPosition)
                return;

			if (LastPosition.X - LastDown.X != 0 || LastPosition.Y - LastDown.Y != 0)
			{
                var thetaRadian = Math.Atan2(e.X - LastDown.X, e.Y - LastDown.Y) - Math.Atan2(LastPosition.X - LastDown.X, LastPosition.Y - LastDown.Y);
				//var theta = Math.PI / 4;
				var center = Viewport.ClientToWorld().Transform(LastDown.ToWinPoint());
				var theta = (thetaRadian / Math.PI * 180);
				//_view.RotateAtPrepend(theta / Math.PI * 180, center.X, center.Y);

                Viewport.RotateAtPrepend(theta, center.X, center.Y);
                Viewport.Angle = (Viewport.Angle + theta) % 360;
				/*Viewport.Camera.RotateAt((float)theta, new PointF((float)center.X, (float)center.Y));
                Viewport.Angle = (Viewport.Angle - theta) % 360;
				var camera = Viewport.Camera;

				var inv = (MatrixF)camera.Clone();
				inv.Invert();

				var points = new[] { new PointF(camera.OffsetX, camera.OffsetY) };
				inv.TransformVectors(points);
				var t = points[0];

				Viewport.Translate(t.X, t.Y);
				Viewport.Camera.Translate(-camera.OffsetX, -camera.OffsetY, System.Drawing.Drawing2D.MatrixOrder.Append);
                */
				Viewport.PerformWindowChanged(WindowChangedEventType.Rotate);
				Viewport.Invalidate();
			}
			
			base.PointerMove(e);
		}
Example #2
0
		public override void PointerUp(ToolEventArgs e)
		{
			if (IsDragging)
			{
				IsDragging = false;
				OnDragComplete(e);
			}

			base.PointerUp(e);
		}
Example #3
0
		public override void PointerMove(ToolEventArgs e)
		{
			if (IsDown && !IsDragging && Dragging(LastDown, e.Location))
			{
				IsDragging = true;
				OnDragStart(e);
			}
			if (!IsDown || IsDragging)
				base.PointerMove(e);
			
		}
Example #4
0
		public override void PointerUp(ToolEventArgs e)
		{
			if (!_dragRectangle.IsEmpty)
			{
				OnComplete();


				Viewport.Invalidate(FixRectangle(_dragRectangle));
				_dragRectangle = Rectangle.Empty;
			}
			base.PointerUp(e);
		}
Example #5
0
		protected virtual void OnDragComplete(ToolEventArgs e)
		{ }
Example #6
0
		protected virtual void OnDragStart(ToolEventArgs e)
		{ }
Example #7
0
		public override void PointerUp(ToolEventArgs e)
		{
			if (!IsDragging)
				Select(GetPickBox(e.Location));
			base.PointerUp(e);
		}
Example #8
0
		public override void PointerMove(ToolEventArgs e)
		{
			if (IsDragging)
				InternalPointerMove(new Point(e.X,e.Y));
			base.PointerMove(e);
		}
Example #9
0
		protected override void OnDragStart(ToolEventArgs e)
		{
			InternalPointerMove(new Point(e.X, e.Y));
			base.OnDragStart(e);
		}
Example #10
0
		public virtual void PointerUp(ToolEventArgs e)
		{
			_lastPosition = e.Location;
			_lastPositionWCS = e.LocationWCS;
			IsDown = false;
		}
Example #11
0
		public virtual void PointerMove(ToolEventArgs e)
		{
			_lastPosition = e.Location;
			_lastPositionWCS = e.LocationWCS;
		}
Example #12
0
		public virtual void PointerDown(ToolEventArgs e)
		{
			_lastDown = _lastPosition = e.Location;
			_lastPositionWCS = _lastDownWCS = e.LocationWCS;
			IsDown = true;
		}