本文整理汇总了C#中UMD.HCIL.Piccolo.PNode.GlobalToLocal方法的典型用法代码示例。如果您正苦于以下问题:C# PNode.GlobalToLocal方法的具体用法?C# PNode.GlobalToLocal怎么用?C# PNode.GlobalToLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMD.HCIL.Piccolo.PNode
的用法示例。
在下文中一共展示了PNode.GlobalToLocal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DirectCameraViewToFocus
public virtual PActivity DirectCameraViewToFocus(PCamera aCamera, PNode aFocusNode, PPickPath path, int duration) {
PMatrix originalViewMatrix = aCamera.ViewMatrix;
// Scale the canvas to include
SizeF s = new SizeF(1, 0);
s = aFocusNode.GlobalToLocal(s);
float scaleFactor = s.Width / aCamera.ViewScale;
PointF scalePoint = PUtil.CenterOfRectangle(aFocusNode.GlobalFullBounds);
if (scaleFactor != 1) {
aCamera.ScaleViewBy(scaleFactor, scalePoint.X, scalePoint.Y);
}
// Pan the canvas to include the view bounds with minimal canvas
// movement.
aCamera.AnimateViewToPanToBounds(aFocusNode.GlobalFullBounds, 0);
// Get rid of any white space. The canvas may be panned and
// zoomed in to do this. But make sure not stay constrained by max
// magnification.
//FillViewWhiteSpace(aCamera);
PMatrix resultingMatrix = aCamera.ViewMatrix;
aCamera.ViewMatrix = originalViewMatrix;
// Animate the canvas so that it ends up with the given
// view transform.
PActivity animateCameraViewActivity = AnimateCameraViewMatrixTo(aCamera, resultingMatrix, duration);
PControl controlNode = (PControl)aFocusNode;
aCamera.Root.WaitForActivities();
controlNode.CurrentCanvas = path.TopCamera.Canvas;
PointF pf = path.GetPathTransformTo(controlNode).Transform(new PointF(controlNode.X, controlNode.Y));
controlNode.ControlLocation = new Point((int)pf.X, (int)pf.Y);
controlNode.Editing = true;
return animateCameraViewActivity;
}
示例2: Accept
/// <summary>
/// Returns true if the node's bounds intersects the bounds specified by the
/// BoundsFilter.
/// </summary>
/// <remarks>
/// For a node to be accepted, it must also satisfy the following conditions:
/// it must be pickable, it must not be the marquee node, it must not be a
/// selectable parent, and the it must not be a layer that is viewed by a camera
/// that is a selectable parent
/// </remarks>
/// <param name="node">The node to test.</param>
/// <returns>True if the node is accepted; otherwise, false.</returns>
public virtual bool Accept(PNode node) {
localBounds = bounds;
localBounds = node.GlobalToLocal(localBounds);
bool boundsIntersects = node.Intersects(localBounds);
bool isMarquee = (node == selectionHandler.marquee);
return (node.Pickable && boundsIntersects && !isMarquee &&
!selectionHandler.selectableParents.Contains(node) && !IsCameraLayer(node));
}