本文整理汇总了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;
}
示例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);
});
}