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


Java PBounds.getCenterY方法代码示例

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


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

示例1: relocateHandle

import org.piccolo2d.util.PBounds; //导入方法依赖的package包/类
/**
 * Force this handle to relocate itself using its locator.
 */
public void relocateHandle() {
    if (locator != null) {
        final PBounds b = getBoundsReference();
        final Point2D aPoint = locator.locatePoint(null);

        if (locator instanceof PNodeLocator) {
            final PNode located = ((PNodeLocator) locator).getNode();
            final PNode parent = getParent();

            located.localToGlobal(aPoint);
            globalToLocal(aPoint);

            if (parent != located && parent instanceof PCamera) {
                ((PCamera) parent).viewToLocal(aPoint);
            }
        }

        final double newCenterX = aPoint.getX();
        final double newCenterY = aPoint.getY();

        if (newCenterX != b.getCenterX() || newCenterY != b.getCenterY()) {
            centerBoundsOnPoint(newCenterX, newCenterY);
        }
    }
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:29,代码来源:PSWTHandle.java

示例2: relocateHandle

import org.piccolo2d.util.PBounds; //导入方法依赖的package包/类
/**
 * Force this handle to relocate itself using its locator.
 */
public void relocateHandle() {
    if (locator == null) {
        return;
    }

    final PBounds b = getBoundsReference();
    final Point2D aPoint = locator.locatePoint(null);

    if (locator instanceof PNodeLocator) {
        final PNode located = ((PNodeLocator) locator).getNode();
        final PNode parent = getParent();

        located.localToGlobal(aPoint);
        globalToLocal(aPoint);

        if (parent != located && parent instanceof PCamera) {
            ((PCamera) parent).viewToLocal(aPoint);
        }
    }

    final double newCenterX = aPoint.getX();
    final double newCenterY = aPoint.getY();

    if (newCenterX != b.getCenterX() || newCenterY != b.getCenterY()) {

        centerBoundsOnPoint(newCenterX, newCenterY);
    }

}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:33,代码来源:PHandle.java


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