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