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


C++ PlatformWheelEvent::phase方法代码示例

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


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

示例1: willWheelEventStartSwipeGesture

bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wheelEvent)
{
    if (wheelEvent.phase() != PlatformWheelEventPhaseBegan)
        return false;

    MutexLocker lock(m_swipeStateMutex);

    if (wheelEvent.deltaX() > 0 && m_mainFramePinnedToTheLeft && !m_rubberBandsAtLeft)
        return true;
    if (wheelEvent.deltaX() < 0 && m_mainFramePinnedToTheRight && !m_rubberBandsAtRight)
        return true;
    if (wheelEvent.deltaY() > 0 && m_mainFramePinnedToTheTop && !m_rubberBandsAtTop)
        return true;
    if (wheelEvent.deltaY() < 0 && m_mainFramePinnedToTheBottom && !m_rubberBandsAtBottom)
        return true;

    return false;
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:18,代码来源:ScrollingTree.cpp

示例2: wheelEvent

void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent, bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom)
{
    PlatformWheelEvent platformWheelEvent = platform(wheelEvent);

#if PLATFORM(COCOA)
    switch (wheelEvent.phase()) {
    case PlatformWheelEventPhaseBegan:
        m_recentWheelEventDeltaTracker->beginTrackingDeltas();
        break;
    case PlatformWheelEventPhaseEnded:
        m_recentWheelEventDeltaTracker->endTrackingDeltas();
        break;
    default:
        break;
    }

    if (m_recentWheelEventDeltaTracker->isTrackingDeltas()) {
        m_recentWheelEventDeltaTracker->recordWheelEventDelta(platformWheelEvent);

        DominantScrollGestureDirection dominantDirection = DominantScrollGestureDirection::None;
        dominantDirection = m_recentWheelEventDeltaTracker->dominantScrollGestureDirection();

        // Workaround for scrolling issues <rdar://problem/14758615>.
        if (dominantDirection == DominantScrollGestureDirection::Vertical && platformWheelEvent.deltaX())
            platformWheelEvent = platformWheelEvent.copyIgnoringHorizontalDelta();
        else if (dominantDirection == DominantScrollGestureDirection::Horizontal && platformWheelEvent.deltaY())
            platformWheelEvent = platformWheelEvent.copyIgnoringVerticalDelta();
    }
#endif

#if ENABLE(ASYNC_SCROLLING)
    MutexLocker locker(m_scrollingTreesMutex);
    if (RefPtr<ThreadedScrollingTree> scrollingTree = m_scrollingTrees.get(pageID)) {
        // FIXME: It's pretty horrible that we're updating the back/forward state here.
        // WebCore should always know the current state and know when it changes so the
        // scrolling tree can be notified.
        // We only need to do this at the beginning of the gesture.
        if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan) {
            ScrollingThread::dispatch([scrollingTree, canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom] {
                scrollingTree->setCanRubberBandState(canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom);
            });
        }

        ScrollingTree::EventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent);

#if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)
        if (result == ScrollingTree::DidHandleEvent)
            updateWheelEventTestTriggersIfNeeded(pageID);
#endif

        if (result == ScrollingTree::DidHandleEvent || result == ScrollingTree::DidNotHandleEvent) {
            sendDidReceiveEvent(pageID, wheelEvent, result == ScrollingTree::DidHandleEvent);
            return;
        }
    }
#else
    UNUSED_PARAM(canRubberBandAtLeft);
    UNUSED_PARAM(canRubberBandAtRight);
    UNUSED_PARAM(canRubberBandAtTop);
    UNUSED_PARAM(canRubberBandAtBottom);
#endif

    RefPtr<EventDispatcher> eventDispatcher(this);
    RunLoop::main().dispatch([eventDispatcher, pageID, wheelEvent] {
        eventDispatcher->dispatchWheelEvent(pageID, wheelEvent);
    }); 
}
开发者ID:JoKaWare,项目名称:webkit,代码行数:67,代码来源:EventDispatcher.cpp


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