本文整理汇总了C++中PlatformWheelEvent::canScroll方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformWheelEvent::canScroll方法的具体用法?C++ PlatformWheelEvent::canScroll怎么用?C++ PlatformWheelEvent::canScroll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformWheelEvent
的用法示例。
在下文中一共展示了PlatformWheelEvent::canScroll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleWheel
ScrollResult ScrollableArea::handleWheel(const PlatformWheelEvent& wheelEvent)
{
// Wheel events which do not scroll are used to trigger zooming.
if (!wheelEvent.canScroll())
return ScrollResult();
cancelProgrammaticScrollAnimation();
return scrollAnimator()->handleWheelEvent(wheelEvent);
}
示例2: adoptRefWillBeNoop
PassRefPtrWillBeRawPtr<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
{
return adoptRefWillBeNoop(new WheelEvent(FloatPoint(event.wheelTicksX(), event.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()),
convertDeltaMode(event), view, event.globalPosition(), event.position(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
MouseEvent::platformModifiersToButtons(event.modifiers()),
event.canScroll(), event.hasPreciseScrollingDeltas(),
static_cast<Event::RailsMode>(event.railsMode())));
}
示例3: handleWheel
ScrollResult RootFrameViewport::handleWheel(const PlatformWheelEvent& event)
{
updateScrollAnimator();
ScrollableArea& primary = !m_invertScrollOrder ? layoutViewport() : visualViewport();
ScrollableArea& secondary = !m_invertScrollOrder ? visualViewport() : layoutViewport();
ScrollResult viewScrollResult = primary.handleWheel(event);
// The visual viewport will only accept pixel scrolls.
if (!event.canScroll() || event.granularity() == ScrollByPageWheelEvent)
return viewScrollResult;
// TODO(sataya.m) : The delta in PlatformWheelEvent is negative when scrolling the
// wheel towards the user, so negate it to get the scroll delta that should be applied
// to the page. unusedScrollDelta computed in the ScrollResult is also negative. Say
// there is WheelEvent({0, -10} and page scroll by 2px and unusedScrollDelta computed
// is {0, -8}. Due to which we have to negate the unusedScrollDelta to obtain the expected
// animation.Please address http://crbug.com/504389.
DoublePoint oldOffset = secondary.scrollPositionDouble();
DoublePoint locationDelta;
if (viewScrollResult.didScroll()) {
locationDelta = -DoublePoint(viewScrollResult.unusedScrollDeltaX, viewScrollResult.unusedScrollDeltaY);
} else {
if (event.railsMode() != PlatformEvent::RailsModeVertical)
locationDelta.setX(-event.deltaX());
if (event.railsMode() != PlatformEvent::RailsModeHorizontal)
locationDelta.setY(-event.deltaY());
}
DoublePoint targetPosition = secondary.clampScrollPosition(
secondary.scrollPositionDouble() + toDoubleSize(locationDelta));
secondary.setScrollPosition(targetPosition, UserScroll);
DoublePoint usedLocationDelta(secondary.scrollPositionDouble() - oldOffset);
bool didScrollX = viewScrollResult.didScrollX || usedLocationDelta.x();
bool didScrollY = viewScrollResult.didScrollY || usedLocationDelta.y();
return ScrollResult(didScrollX, didScrollY, -viewScrollResult.unusedScrollDeltaX - usedLocationDelta.x(), -viewScrollResult.unusedScrollDeltaY - usedLocationDelta.y());
}