コード例 #1
0
ファイル: volumeslice.cpp プロジェクト: sunwj/inviwo
void VolumeSlice::eventGestureShiftSlice(Event* event) {
    GestureEvent* gestureEvent = static_cast<GestureEvent*>(event);
    if (gestureEvent->deltaPos().y < 0)
        shiftSlice(1);
    else if (gestureEvent->deltaPos().y > 0)
        shiftSlice(-1);
}
コード例 #2
0
void PointLightInteractionHandler::invokeEvent(Event* event) {
    // if(event->hasBeenUsed())
    //    return;

    if (screenPosEnabled_->get()) setLightPosFromScreenCoords(screenPos_->get());

    if (interactionEventOption_ == 1 || interactionEventOption_ == 3) {
        GestureEvent* gestureEvent = dynamic_cast<GestureEvent*>(event);
        if (gestureEvent) {
            if (gestureEvent->type() == GestureEvent::PAN) {
                setLightPosFromScreenCoords(gestureEvent->screenPosNormalized());
                gestureEvent->markAsUsed();
                return;
            }
        }
        MouseEvent* mouseEvent = dynamic_cast<MouseEvent*>(event);
        if (mouseEvent) {
            int button = mouseEvent->button();
            if (button == MouseEvent::MOUSE_BUTTON_MIDDLE) {
                // setLightPosFromScreenCoords(mouseEvent->posNormalized());
                mouseEvent->markAsUsed();
                screenPos_->set(mouseEvent->posNormalized());
                return;
            }
        }
    }

    if (interactionEventOption_ == 1 || interactionEventOption_ == 2) trackball_.invokeEvent(event);
}
コード例 #3
0
void CinderKinectServerApp::gestureRecognized( GestureEvent event )
{
    int size = 4 + 12;
    unsigned char *msg = new unsigned char[size];
    
    int type;
    
    if (boost::iequals(event.getGesture(), "Wave"))
    {
        type = WAVE;
    }
    else if (boost::iequals(event.getGesture(), "RaiseHand"))
    {
        type = RAISE_HAND;
    }
    else if (boost::iequals(event.getGesture(), "Click"))
    {
        type = CLICK;
    }
    else if (boost::iequals(event.getGesture(), "Swipe_Right"))
    {
        type = SWIPE_RIGHT;
    }
    else if (boost::iequals(event.getGesture(), "Swipe_Left"))
    {
        type = SWIPE_LEFT;
    }
    else
    {
        return;
    }
    
    memcpy(msg, &type, 4);
    putJoint(Vec3f( event.getX(), event.getY(), event.getZ() ), msg + 4);
    
    server->sendMessage(GESTURE_EVENT, GESTURE_RECOGNIZED, msg, size);
}
コード例 #4
0
WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const GestureEvent& event)
{
    if (event.type() == EventTypeNames::gestureshowpress)
        type = GestureShowPress;
    else if (event.type() == EventTypeNames::gesturetapdown)
        type = GestureTapDown;
    else if (event.type() == EventTypeNames::gesturescrollstart)
        type = GestureScrollBegin;
    else if (event.type() == EventTypeNames::gesturescrollend)
        type = GestureScrollEnd;
    else if (event.type() == EventTypeNames::gesturescrollupdate) {
        type = GestureScrollUpdate;
        data.scrollUpdate.deltaX = event.deltaX();
        data.scrollUpdate.deltaY = event.deltaY();
    } else if (event.type() == EventTypeNames::gesturetap) {
        type = GestureTap;
        data.tap.tapCount = 1;
    }

    timeStampSeconds = event.timeStamp() / millisPerSecond;
    modifiers = getWebInputModifiers(event);

    globalX = event.screenX();
    globalY = event.screenY();
    IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteLocation(), *renderObject);
    x = localPoint.x();
    y = localPoint.y();
}
コード例 #5
0
WebGestureEventBuilder::WebGestureEventBuilder(const LayoutObject* layoutObject, const GestureEvent& event)
{
    if (event.type() == EventTypeNames::gestureshowpress) {
        type = GestureShowPress;
    } else if (event.type() == EventTypeNames::gesturelongpress) {
        type = GestureLongPress;
    } else if (event.type() == EventTypeNames::gesturetapdown) {
        type = GestureTapDown;
    } else if (event.type() == EventTypeNames::gesturescrollstart) {
        type = GestureScrollBegin;
        resendingPluginId = event.resendingPluginId();
    } else if (event.type() == EventTypeNames::gesturescrollend) {
        type = GestureScrollEnd;
        resendingPluginId = event.resendingPluginId();
    } else if (event.type() == EventTypeNames::gesturescrollupdate) {
        type = GestureScrollUpdate;
        data.scrollUpdate.deltaX = event.deltaX();
        data.scrollUpdate.deltaY = event.deltaY();
        data.scrollUpdate.inertial = event.inertial();
        resendingPluginId = event.resendingPluginId();
    } else if (event.type() == EventTypeNames::gestureflingstart) {
        type = GestureFlingStart;
        data.flingStart.velocityX = event.velocityX();
        data.flingStart.velocityY = event.velocityY();
    } else if (event.type() == EventTypeNames::gesturetap) {
        type = GestureTap;
        data.tap.tapCount = 1;
    }

    timeStampSeconds = event.platformTimeStamp();
    modifiers = event.modifiers();

    globalX = event.screenX();
    globalY = event.screenY();
    IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteLocation(), *layoutObject);
    x = localPoint.x();
    y = localPoint.y();

    switch (event.source()) {
    case GestureSourceTouchpad:
        sourceDevice = WebGestureDeviceTouchpad;
        break;
    case GestureSourceTouchscreen:
        sourceDevice = WebGestureDeviceTouchscreen;
        break;
    case GestureSourceUninitialized:
        ASSERT_NOT_REACHED();
    }
}