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


C# CGRect.IntersectsWith方法代码示例

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


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

示例1: DrawRect

		public override void DrawRect (CGRect dirtyRect)
		{
			base.DrawRect (dirtyRect);
			if (statusIcons.Count == 0 || buildResults.Hidden) {
				return;
			}

			var x = LeftMostStatusItemX ();
			var sepRect = new CGRect (x - 9, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 5 : 4, 1, 16);
			if (!sepRect.IntersectsWith (dirtyRect)) {
				return;
			}

			NSColor.LightGray.SetFill ();
			NSBezierPath.FillRect (sepRect);
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:16,代码来源:StatusBar.cs

示例2: DrawSeparator

		static void DrawSeparator (nfloat x, CGRect dirtyRect)
		{
			var sepRect = new CGRect (x - 6.5, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 4 : 3, 1, 16);
			if (sepRect.IntersectsWith (dirtyRect)) {
				NSColor.LightGray.SetFill ();
				NSBezierPath.FillRect (sepRect);
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:8,代码来源:StatusBar.cs

示例3: ComputeDifferenceBetweenRect

		static void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler)
		{
			if (!oldRect.IntersectsWith (newRect)) {
				addedHandler (newRect);
				removedHandler (oldRect);
			} else {
				nfloat oldMaxY = oldRect.GetMaxY ();
				nfloat oldMinY = oldRect.GetMinY ();
				nfloat newMaxY = newRect.GetMaxY ();
				nfloat newMinY = newRect.GetMinY ();

				if (newMaxY > oldMaxY) {
					var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY);
					addedHandler(rectToAdd);
				}

				if (oldMinY > newMinY) {
					var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY);
					addedHandler(rectToAdd);
				}

				if (newMaxY < oldMaxY) {
					var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY);
					removedHandler(rectToRemove);
				}

				if (oldMinY < newMinY) {
					var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY);
					removedHandler(rectToRemove);
				}
			}
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:32,代码来源:AssetGridViewController.cs

示例4: IsVisibleInRect

			public bool IsVisibleInRect (CGRect r)
			{
				// Returns true if the layer for this segment is visible in the given rect.
				return r.IntersectsWith (Layer.Frame);
			}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:5,代码来源:GraphView.cs

示例5: TouchesMoved

        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
			if (_map.Lock) return;

            if ((uint)touches.Count == 1)
            {
                var touch = touches.AnyObject as UITouch;
                if (touch != null)
                {
                    var currentPos = (CGPoint)touch.LocationInView((UIView)this);
                    var previousPos = (CGPoint)touch.PreviousLocationInView((UIView)this);

                    var cRect = new CGRect(new CGPoint((int)currentPos.X, (int)currentPos.Y), new CGSize(5, 5));
                    var pRect = new CGRect(new CGPoint((int)previousPos.X, (int)previousPos.Y), new CGSize(5, 5));

                    if (!cRect.IntersectsWith(pRect))
                    {
                        _map.Viewport.Transform(currentPos.X, currentPos.Y, previousPos.X, previousPos.Y);

                        RefreshGraphics();
                    }
                }
            }
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:24,代码来源:MapControlUIKit.cs

示例6: LayoutAttributesForElementsInRect

		public override UICollectionViewLayoutAttributes[] LayoutAttributesForElementsInRect (CGRect rect)
		{
			int begin = 0;
			int end = unionRects.Count;
			var attrs = new List<UICollectionViewLayoutAttributes> ();


			for (int i = 0; i < end; i++)
				if (rect.IntersectsWith (unionRects [i]))
					begin = i * (int)unionSize;

			for (int i = end - 1; i >= 0; i--) {
				if (rect.IntersectsWith (unionRects [i])) {
					end = Math.Min ((i + 1) * (int)unionSize, allItemAttributes.Count);
					break;
				}
			}

			for (int i = begin; i < end; i++) {
				var attr = allItemAttributes [i];
				if (rect.IntersectsWith (attr.Frame)) {
					attrs.Add (attr);
				}
			}

			return attrs.ToArray ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:27,代码来源:WaterfallCollectionLayout.cs

示例7: ComputeDifferenceBetweenRect

		static Rects ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect)
		{
			if (!oldRect.IntersectsWith (newRect)) {
				return new Rects {
					Added = new CGRect [] { newRect },
					Removed = new CGRect [] { oldRect }
				};
			}

			var oldMaxY = oldRect.GetMaxY ();
			var oldMinY = oldRect.GetMinY ();
			var newMaxY = newRect.GetMaxY ();
			var newMinY = newRect.GetMinY ();

			var added = new List<CGRect> ();
			var removed = new List<CGRect> ();

			if (newMaxY > oldMaxY)
				added.Add (new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY));

			if (oldMinY > newMinY)
				added.Add (new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY));

			if (newMaxY < oldMaxY)
				removed.Add (new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY));

			if (oldMinY < newMinY)
				removed.Add (new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY));

			return new Rects {
				Added = added,
				Removed = removed
			};
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:34,代码来源:AssetGridViewController.cs


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