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


C# PNode.GlobalToLocal方法代码示例

本文整理汇总了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;
		}
开发者ID:ArsenShnurkov,项目名称:piccolo2d.net,代码行数:40,代码来源:PControlEventHandler2.cs

示例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));
			}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:21,代码来源:PSelectionEventHandler.cs


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