本文整理汇总了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);
}
示例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);
}
示例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);
}
}