本文整理汇总了C++中webcore::IntRect::minXMaxYCorner方法的典型用法代码示例。如果您正苦于以下问题:C++ IntRect::minXMaxYCorner方法的具体用法?C++ IntRect::minXMaxYCorner怎么用?C++ IntRect::minXMaxYCorner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::IntRect
的用法示例。
在下文中一共展示了IntRect::minXMaxYCorner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WouldBeTrappedInElement
static bool WouldBeTrappedInElement(const WebCore::IntRect& rect, const WebCore::IntPoint& point, EA::WebKit::JumpDirection direction)
{
// If we're not inside, don't worry
if (rect.contains(point))
{
typedef WebCore::IntPoint Vector2D;
const WebCore::IntPoint centre = Average( rect.minXMaxYCorner(), rect.maxXMinYCorner() );
Vector2D pointToCentre = Subtract(centre,point);
Vector2D forward;
switch (direction)
{
// note these are 'backward
case EA::WebKit::JumpUp: forward = Vector2D(0,-100); break;
case EA::WebKit::JumpDown: forward = Vector2D(0,100); break;
case EA::WebKit::JumpLeft: forward = Vector2D(-100,0); break;
case EA::WebKit::JumpRight: forward = Vector2D(100,0); break;
}
// Basically, if the centre is behind us, don't jump there
if (DotProduct(forward,pointToCentre) < 0)
{
return false;
}
else
{
/*printf("(%d,%d) Trapped Inside Element (%d,%d)->(%d,%d): forward=(%d,%d) pointToCentre=(%d,%d) dot=%d\n",
point.x(),
point.y(),
rect.bottomLeft().x(),
rect.bottomLeft().y(),
rect.topRight().x(),
rect.topRight().y(),
forward.x(),
forward.y(),
pointToCentre.x(),
pointToCentre.y(),
DotProduct(forward,pointToCentre)
);*/
return true;
}
}
else
{
return false;
}
}