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


C++ PlatformGestureEvent::velocityY方法代码示例

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


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

示例1: adoptRefWillBeNoop

PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtrWillBeRawPtr<AbstractView> view, const PlatformGestureEvent& event)
{
    AtomicString eventType;
    float deltaX = 0;
    float deltaY = 0;
    float velocityX = 0;
    float velocityY = 0;
    bool inertial = false;

    GestureSource source = GestureSourceUninitialized;
    switch (event.source()) {
    case PlatformGestureSourceTouchpad:
        source = GestureSourceTouchpad;
        break;
    case PlatformGestureSourceTouchscreen:
        source = GestureSourceTouchscreen;
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    switch (event.type()) {
    case PlatformEvent::GestureScrollBegin:
        eventType = EventTypeNames::gesturescrollstart; break;
    case PlatformEvent::GestureScrollEnd:
        eventType = EventTypeNames::gesturescrollend; break;
    case PlatformEvent::GestureScrollUpdate:
        // Only deltaX/Y are used when converting this
        // back to a PlatformGestureEvent.
        eventType = EventTypeNames::gesturescrollupdate;
        deltaX = event.deltaX();
        deltaY = event.deltaY();
        inertial = event.inertial();
        break;
    case PlatformEvent::GestureTap:
        eventType = EventTypeNames::gesturetap; break;
    case PlatformEvent::GestureTapUnconfirmed:
        eventType = EventTypeNames::gesturetapunconfirmed; break;
    case PlatformEvent::GestureTapDown:
        eventType = EventTypeNames::gesturetapdown; break;
    case PlatformEvent::GestureShowPress:
        eventType = EventTypeNames::gestureshowpress; break;
    case PlatformEvent::GestureLongPress:
        eventType = EventTypeNames::gesturelongpress; break;
    case PlatformEvent::GestureFlingStart:
        eventType = EventTypeNames::gestureflingstart;
        velocityX = event.velocityX();
        velocityY = event.velocityY();
        break;
    case PlatformEvent::GestureTwoFingerTap:
    case PlatformEvent::GesturePinchBegin:
    case PlatformEvent::GesturePinchEnd:
    case PlatformEvent::GesturePinchUpdate:
    case PlatformEvent::GestureTapDownCancel:
    default:
        return nullptr;
    }
    return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.modifiers(), deltaX, deltaY, velocityX, velocityY, inertial, event.timestamp(), event.resendingPluginId(), source));
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:59,代码来源:GestureEvent.cpp


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