本文整理汇总了Java中org.piccolo2d.PCamera.localToView方法的典型用法代码示例。如果您正苦于以下问题:Java PCamera.localToView方法的具体用法?Java PCamera.localToView怎么用?Java PCamera.localToView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.piccolo2d.PCamera
的用法示例。
在下文中一共展示了PCamera.localToView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dragActivityStep
import org.piccolo2d.PCamera; //导入方法依赖的package包/类
/**
* Performs auto-panning if enabled, even when the mouse is not moving.
*
* @param event current drag relevant details about the drag activity
*/
protected void dragActivityStep(final PInputEvent event) {
if (!autopan) {
return;
}
final PCamera c = event.getCamera();
final PBounds b = c.getBoundsReference();
final Point2D l = event.getPositionRelativeTo(c);
final int outcode = b.outcode(l);
final PDimension delta = new PDimension();
if ((outcode & Rectangle2D.OUT_TOP) != 0) {
delta.height = validatePanningSpeed(-1.0 - 0.5 * Math.abs(l.getY() - b.getY()));
}
else if ((outcode & Rectangle2D.OUT_BOTTOM) != 0) {
delta.height = validatePanningSpeed(1.0 + 0.5 * Math.abs(l.getY() - (b.getY() + b.getHeight())));
}
if ((outcode & Rectangle2D.OUT_RIGHT) != 0) {
delta.width = validatePanningSpeed(1.0 + 0.5 * Math.abs(l.getX() - (b.getX() + b.getWidth())));
}
else if ((outcode & Rectangle2D.OUT_LEFT) != 0) {
delta.width = validatePanningSpeed(-1.0 - 0.5 * Math.abs(l.getX() - b.getX()));
}
c.localToView(delta);
if (delta.width != 0 || delta.height != 0) {
c.translateView(delta.width, delta.height);
}
}
示例2: mouseWheelRotated
import org.piccolo2d.PCamera; //导入方法依赖的package包/类
@Override
public void mouseWheelRotated(PInputEvent e) {
LOGGER.trace("Method mouseWheelRotated("
+ e + ") called.");
PCamera vCamera = ((PCanvas) mPanel.getPanel()).getCamera();
double vScale = 1.0
- 0.05
* e.getWheelRotation();
vCamera.localToView(e.getPosition());
vCamera.scaleViewAboutPoint(vScale, e.getPosition().getX(), e.getPosition().getY());
}