Java 类javafx.scene.input.RotateEvent 实例源码

项目:JavaFX-SWT-Gesture-Bridge    文件:SwtToFXGestureConverter.java   
private void sendRotateEvent(EventType<RotateEvent> fxEventType,
            final GestureEvent event,
            TKSceneListener sceneListener) {
        Point screenPosition = canvas.toDisplay(event.x, event.y);
        double rotation = (fxEventType == RotateEvent.ROTATION_FINISHED) 
                ? currentState.lastRotation
                : -event.rotation;
//      System.out.println(fxEventType + " " + rotation);
        sceneListener.rotateEvent(fxEventType,
                rotation - currentState.lastRotation, // rotation
                rotation,               // totalRotation
                event.x, event.y,       // x, y
                screenPosition.x, screenPosition.y,           // screenX, screenY
                isShift(event), isControl(event), isAlt(event), isMeta(event), 
                false,      // direct 
                false);     // inertia
        currentState.lastRotation = rotation;
    }
项目:tokentool    文件:TokenTool_Controller.java   
@FXML
void compositeTokenPane_OnRotate(RotateEvent event) {
    log.info("isDirect(): " + event.isDirect());
    log.info("getTotalAngle" + event.getTotalAngle());

    double r = portraitImageView.getRotate() + (event.getAngle() * 0.75);
    if (r < -360d || r > 360d)
        r = 0d;

    portraitImageView.setRotate(r);
    event.consume();
}
项目:JavaFX-SWT-Gesture-Bridge    文件:SwtToFXGestureConverter.java   
protected boolean changeState(StateType newStateType, GestureEvent event, TKSceneListener sceneListener) {
    if(newStateType != currentState.type) { 
        switch (currentState.type) {
            case SCROLLING:
                sendScrollEvent(ScrollEvent.SCROLL_FINISHED, event, sceneListener);
                break;
            case ROTATING:
                sendRotateEvent(RotateEvent.ROTATION_FINISHED, event, sceneListener);
                break;
            case ZOOMING:
                sendZoomEvent(ZoomEvent.ZOOM_FINISHED, event, sceneListener);
                break;
            default:
                // do nothing
        }
        switch (newStateType) {
            case SCROLLING:
                sendScrollEvent(ScrollEvent.SCROLL_STARTED, event, sceneListener);
                break;
            case ROTATING:
                sendRotateEvent(RotateEvent.ROTATION_STARTED, event, sceneListener);
                break;
            case ZOOMING:
                sendZoomEvent(ZoomEvent.ZOOM_STARTED, event, sceneListener);
                break;
            case IDLE:
                if(event.detail == SWT.GESTURE_SWIPE)
                    sendSwipeEvent(event, sceneListener);
                break;
            default:
                // do nothing
        }
        currentState = new State(newStateType);
        return true;
    }
    switch (newStateType) {
        case SCROLLING:
            sendScrollEvent(ScrollEvent.SCROLL, event, sceneListener);
            break;
        case ROTATING:
            sendRotateEvent(RotateEvent.ROTATE, event, sceneListener);
            break;
        case ZOOMING:
            sendZoomEvent(ZoomEvent.ZOOM, event, sceneListener);
            break;
        case IDLE:
            if(event.detail == SWT.GESTURE_SWIPE)
                sendSwipeEvent(event, sceneListener);
        default:
            // do nothing
    }
    return false;
}