本文整理汇总了C++中PlatformWheelEvent::hasPreciseScrollingDeltas方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformWheelEvent::hasPreciseScrollingDeltas方法的具体用法?C++ PlatformWheelEvent::hasPreciseScrollingDeltas怎么用?C++ PlatformWheelEvent::hasPreciseScrollingDeltas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformWheelEvent
的用法示例。
在下文中一共展示了PlatformWheelEvent::hasPreciseScrollingDeltas方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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())));
}
示例2: handleWheelEvent
bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
{
bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar);
bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar);
// Accept the event if we are scrollable in that direction and can still
// scroll any further.
float deltaX = canScrollX ? e.deltaX() : 0;
float deltaY = canScrollY ? e.deltaY() : 0;
bool handled = false;
#if !OS(MACOSX)
ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel;
#else
ScrollGranularity granularity = ScrollByPixel;
#endif
IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
|| (deltaX > 0 && maxBackwardScrollDelta.width() > 0)
|| (deltaY < 0 && maxForwardScrollDelta.height() > 0)
|| (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
handled = true;
if (deltaY) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaY < 0;
deltaY = m_scrollableArea->pageStep(VerticalScrollbar);
if (negative)
deltaY = -deltaY;
}
scroll(VerticalScrollbar, granularity, m_scrollableArea->pixelStep(VerticalScrollbar), -deltaY);
}
if (deltaX) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaX < 0;
deltaX = m_scrollableArea->pageStep(HorizontalScrollbar);
if (negative)
deltaX = -deltaX;
}
scroll(HorizontalScrollbar, granularity, m_scrollableArea->pixelStep(HorizontalScrollbar), -deltaX);
}
}
return handled;
}
示例3: handleWheelEvent
bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
{
Scrollbar* horizontalScrollbar = m_scrollableArea->horizontalScrollbar();
Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar();
// Accept the event if we have a scrollbar in that direction and can still
// scroll any further.
float deltaX = horizontalScrollbar ? e.deltaX() : 0;
float deltaY = verticalScrollbar ? e.deltaY() : 0;
bool handled = false;
#if PLATFORM(CHROMIUM) && !OS(DARWIN)
ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel;
#else
ScrollGranularity granularity = ScrollByPixel;
#endif
IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
|| (deltaX > 0 && maxBackwardScrollDelta.width() > 0)
|| (deltaY < 0 && maxForwardScrollDelta.height() > 0)
|| (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
handled = true;
if (deltaY) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaY < 0;
deltaY = max(max(static_cast<float>(m_scrollableArea->visibleHeight()) * Scrollbar::minFractionToStepWhenPaging(), static_cast<float>(m_scrollableArea->visibleHeight() - Scrollbar::maxOverlapBetweenPages())), 1.0f);
if (negative)
deltaY = -deltaY;
}
scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
}
if (deltaX) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaX < 0;
deltaX = max(max(static_cast<float>(m_scrollableArea->visibleWidth()) * Scrollbar::minFractionToStepWhenPaging(), static_cast<float>(m_scrollableArea->visibleWidth() - Scrollbar::maxOverlapBetweenPages())), 1.0f);
if (negative)
deltaX = -deltaX;
}
scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
}
}
return handled;
}