本文整理汇总了Java中org.piccolo2d.util.PBounds.contains方法的典型用法代码示例。如果您正苦于以下问题:Java PBounds.contains方法的具体用法?Java PBounds.contains怎么用?Java PBounds.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.piccolo2d.util.PBounds
的用法示例。
在下文中一共展示了PBounds.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillViewWhiteSpace
import org.piccolo2d.util.PBounds; //导入方法依赖的package包/类
/**
* Instantaneously transforms the provided camera so that it does not
* contain any extra white space.
*
* @param camera the camera to be transformed
*/
protected void fillViewWhiteSpace(final PCamera camera) {
final PBounds rootBounds = camera.getRoot().getFullBoundsReference();
if (rootBounds.contains(camera.getViewBounds())) {
return;
}
camera.animateViewToPanToBounds(rootBounds, 0);
camera.animateViewToPanToBounds(focusNode.getGlobalFullBounds(), 0);
// center content.
double dx = 0;
double dy = 0;
PBounds viewBounds = camera.getViewBounds();
if (viewBounds.getWidth() > rootBounds.getWidth()) {
// then center along x axis.
dx = rootBounds.getCenterX() - viewBounds.getCenterX();
}
if (viewBounds.getHeight() > rootBounds.getHeight()) {
// then center along y axis.
dy = rootBounds.getCenterX() - viewBounds.getCenterX();
}
camera.translateView(dx, dy);
}