当前位置: 首页>>代码示例>>C#>>正文


C# PInputEventArgs.GetPositionRelativeTo方法代码示例

本文整理汇总了C#中UMD.HCIL.Piccolo.Event.PInputEventArgs.GetPositionRelativeTo方法的典型用法代码示例。如果您正苦于以下问题:C# PInputEventArgs.GetPositionRelativeTo方法的具体用法?C# PInputEventArgs.GetPositionRelativeTo怎么用?C# PInputEventArgs.GetPositionRelativeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UMD.HCIL.Piccolo.Event.PInputEventArgs的用法示例。


在下文中一共展示了PInputEventArgs.GetPositionRelativeTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDrag

			protected override void OnDrag(object sender, PInputEventArgs e) {
				base.OnDrag (sender, e);

				PointF start = canvas.Camera.LocalToView((PointF)MousePressedCanvasPoint);
				PointF current = e.GetPositionRelativeTo(canvas.Layer);
				PointF dest = PointF.Empty;

				dest.X = nodeStartPosition.X + (current.X - start.X);
				dest.Y = nodeStartPosition.Y + (current.Y - start.Y);

				dest.X = dest.X - (dest.X % gridSpacing);
				dest.Y = dest.Y - (dest.Y % gridSpacing);

				draggedNode.SetOffset(dest.X, dest.Y);
			}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:15,代码来源:GridExample.cs

示例2: OnEndDrag

			/// <summary>
			/// Overridden.  See <see cref="PDragSequenceEventHandler.OnEndDrag">
			/// PDragSequenceEventHandler.OnEndDrag</see>.
			/// </summary>
			protected override void OnEndDrag(object sender, PInputEventArgs e) {
				base.OnEndDrag (sender, e);
				handle.OnEndHandleDrag(sender, e.GetPositionRelativeTo(handle), e);
			}
开发者ID:ArsenShnurkov,项目名称:piccolo2d.net,代码行数:8,代码来源:PHandle.cs

示例3: OnDragActivityStep

		/// <summary>
		/// Overridden.  Do auto-panning even when the mouse is not moving.
		/// </summary>
		/// <param name="sender">The source of the drag event.</param>
		/// <param name="e">A PInputEventArgs that contains the event data.</param>
		protected override void OnDragActivityStep(object sender, PInputEventArgs e) {
			base.OnDragActivityStep(sender, e);

			if (!autopan) return;
		
			PCamera c = e.Camera;
			RectangleF b = c.Bounds;
			PointF l = e.GetPositionRelativeTo(c);
			PUtil.OutCode outcode = PUtil.RectangleOutCode(l, b);
			SizeF delta = SizeF.Empty;
		
			if ((outcode & PUtil.OutCode.Top) != 0) {
				delta.Height = ValidatePanningDelta(-1.0f - (0.5f * Math.Abs(l.Y - b.Y)));
			} else if ((outcode & PUtil.OutCode.Bottom) != 0) {
				delta.Height = ValidatePanningDelta(1.0f + (0.5f * Math.Abs(l.Y - (b.Y + b.Height))));
			}
		
			if ((outcode & PUtil.OutCode.Right) != 0) {
				delta.Width = ValidatePanningDelta(1.0f + (0.5f * Math.Abs(l.X - (b.X + b.Width))));
			} else if ((outcode & PUtil.OutCode.Left) != 0) {
				delta.Width = ValidatePanningDelta(-1.0f - (0.5f * Math.Abs(l.X - b.X)));
			}
		
			delta = c.LocalToView(delta);
		
			if (delta.Width != 0 || delta.Height != 0) {
				c.TranslateViewBy(delta.Width, delta.Height);
			}
		}
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:34,代码来源:PPanEventHandler.cs


注:本文中的UMD.HCIL.Piccolo.Event.PInputEventArgs.GetPositionRelativeTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。