本文整理汇总了Java中edu.umd.cs.piccolo.event.PInputEvent.getCanvasPosition方法的典型用法代码示例。如果您正苦于以下问题:Java PInputEvent.getCanvasPosition方法的具体用法?Java PInputEvent.getCanvasPosition怎么用?Java PInputEvent.getCanvasPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.event.PInputEvent
的用法示例。
在下文中一共展示了PInputEvent.getCanvasPosition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseDragged
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseDragged( PInputEvent e ) {
if ( System.currentTimeMillis() - lastDragTime >= thresholdMillis ) {//you waited too long, now have to start dragging again.
resetDragging();
}
if ( lastPressLocation == null ) {
lastPressLocation = e.getCanvasPosition();
}
double dx = Math.abs( lastPressLocation.getX() - e.getCanvasPosition().getX() );
double dy = Math.abs( lastPressLocation.getY() - e.getCanvasPosition().getY() );
if ( dx >= thresholdX && dy >= thresholdY ) {
isDragging = true;
}
if ( isDragging ) {
// System.out.println( "mouse dragged" + e );
target.mouseDragged( e );
}
lastDragTime = System.currentTimeMillis();
}
示例2: mouseDragged
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
private void mouseDragged( PInputEvent pInputEvent ) {
Point2D pt = pInputEvent.getCanvasPosition();
// Point2D o=getViewOrigin();
Point2D o = getViewOrigin();
localToGlobal( o );
rampPanel.getCamera().globalToLocal( o );
// Point2D pt = pInputEvent.getPositionRelativeTo( this );
//// localToGlobal( pt );
// Point2D o = ramp.getOrigin();
//// localToGlobal( o );
//// pt = getRampWorld().convertToWorld( pt );
// System.out.println( "o = " + o );
// System.out.println( "pt = " + pt );
MutableVector2D vec = new MutableVector2D( o, pt );
System.out.println( "vec = " + vec );
double angle = -vec.getAngle();
System.out.println( "angle = " + angle );
angle = MathUtil.clamp( 0, angle, Math.PI / 2.0 );
ramp.setAngle( angle );
rampPanel.getRampModule().record();
}
示例3: drag
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
protected void drag( PInputEvent event ) {
Point2D pos = event.getCanvasPosition();
double latticeDX = latticeScreenCoordinates.toLatticeCoordinatesDifferentialX( pos.getX() - dragStartPt.getX() );
double latticeDY = latticeScreenCoordinates.toLatticeCoordinatesDifferentialY( pos.getY() - dragStartPt.getY() );
if ( changeStart ) {
wallPotential.setSrcPoint( new Point( origStart.x + (int) latticeDX, origStart.y + (int) latticeDY ) );
}
if ( changeEnd ) {
wallPotential.setDstPoint( new Point( origEnd.x + (int) latticeDX, origEnd.y + (int) latticeDY ) );
}
}
示例4: initializeSelection
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
/**
* Starts a selection based on the provided event.
*
* @param pie event used to populate the selection
*/
protected void initializeSelection(final PInputEvent pie) {
canvasPressPt = pie.getCanvasPosition();
presspt = pie.getPosition();
pressNode = pie.getPath().getPickedNode();
if (pressNode instanceof PCamera) {
pressNode = null;
}
}
示例5: mousePressed
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mousePressed( PInputEvent e ) {
lastPressLocation = e.getCanvasPosition();
target.mousePressed( e );
lastDragTime = System.currentTimeMillis();
}
示例6: startDrag
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
protected void startDrag( PInputEvent event ) {
super.startDrag( event );
this.dragStartPt = event.getCanvasPosition();
origStart = wallPotential.getSource();
origEnd = wallPotential.getDestination();
}
示例7: getPosition
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
private static Point2D getPosition( PInputEvent event ) {
return event.getCanvasPosition();
}
示例8: initializeSelection
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void initializeSelection(final PInputEvent pie) {
super.initializeSelection(pie);
pressPt = pie.getPosition();
canvasPressPt = pie.getCanvasPosition();
}