public GlobalToLocal ( |
||
point | The point in global coordinates to be transformed. | |
return |
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; }
/// <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)); }