本文整理汇总了C++中TouchList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchList::append方法的具体用法?C++ TouchList::append怎么用?C++ TouchList::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchList
的用法示例。
在下文中一共展示了TouchList::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchTouchEvents
WebInputEventResult TouchEventManager::dispatchTouchEvents(
const PlatformTouchEvent& event,
const HeapVector<TouchInfo>& touchInfos,
bool allTouchesReleased)
{
bool touchStartOrFirstTouchMove = false;
if (event.type() == PlatformEvent::TouchStart) {
m_waitingForFirstTouchMove = true;
touchStartOrFirstTouchMove = true;
} else if (event.type() == PlatformEvent::TouchMove) {
touchStartOrFirstTouchMove = m_waitingForFirstTouchMove;
m_waitingForFirstTouchMove = false;
}
// Build up the lists to use for the |touches|, |targetTouches| and
// |changedTouches| attributes in the JS event. See
// http://www.w3.org/TR/touch-events/#touchevent-interface for how these
// lists fit together.
// Holds the complete set of touches on the screen.
TouchList* touches = TouchList::create();
// A different view on the 'touches' list above, filtered and grouped by
// event target. Used for the |targetTouches| list in the JS event.
using TargetTouchesHeapMap = HeapHashMap<EventTarget*, Member<TouchList>>;
TargetTouchesHeapMap touchesByTarget;
// Array of touches per state, used to assemble the |changedTouches| list.
ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd];
for (unsigned i = 0; i < touchInfos.size(); ++i) {
const TouchInfo& touchInfo = touchInfos[i];
const PlatformTouchPoint& point = touchInfo.point;
PlatformTouchPoint::TouchState pointState = point.state();
if (touchInfo.consumed)
continue;
Touch* touch = Touch::create(
touchInfo.targetFrame.get(),
touchInfo.touchNode.get(),
point.id(),
point.screenPos(),
touchInfo.contentPoint,
touchInfo.adjustedRadius,
point.rotationAngle(),
point.force(),
touchInfo.region);
// Ensure this target's touch list exists, even if it ends up empty, so
// it can always be passed to TouchEvent::Create below.
TargetTouchesHeapMap::iterator targetTouchesIterator = touchesByTarget.find(touchInfo.touchNode.get());
if (targetTouchesIterator == touchesByTarget.end()) {
touchesByTarget.set(touchInfo.touchNode.get(), TouchList::create());
targetTouchesIterator = touchesByTarget.find(touchInfo.touchNode.get());
}
// |touches| and |targetTouches| should only contain information about
// touches still on the screen, so if this point is released or
// cancelled it will only appear in the |changedTouches| list.
if (pointState != PlatformTouchPoint::TouchReleased && pointState != PlatformTouchPoint::TouchCancelled) {
touches->append(touch);
targetTouchesIterator->value->append(touch);
}
// Now build up the correct list for |changedTouches|.
// Note that any touches that are in the TouchStationary state (e.g. if
// the user had several points touched but did not move them all) should
// never be in the |changedTouches| list so we do not handle them
// explicitly here. See https://bugs.webkit.org/show_bug.cgi?id=37609
// for further discussion about the TouchStationary state.
if (pointState != PlatformTouchPoint::TouchStationary && touchInfo.knownTarget) {
ASSERT(pointState < PlatformTouchPoint::TouchStateEnd);
if (!changedTouches[pointState].m_touches)
changedTouches[pointState].m_touches = TouchList::create();
changedTouches[pointState].m_touches->append(touch);
changedTouches[pointState].m_targets.add(touchInfo.touchNode);
}
}
if (allTouchesReleased) {
m_touchSequenceDocument.clear();
m_touchSequenceUserGestureToken.clear();
}
WebInputEventResult eventResult = WebInputEventResult::NotHandled;
// Now iterate through the |changedTouches| list and |m_targets| within it,
// sending TouchEvents to the targets as required.
for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state) {
if (!changedTouches[state].m_touches)
continue;
const AtomicString& eventName(touchEventNameForTouchPointState(static_cast<PlatformTouchPoint::TouchState>(state)));
for (const auto& eventTarget : changedTouches[state].m_targets) {
EventTarget* touchEventTarget = eventTarget;
TouchEvent* touchEvent = TouchEvent::create(
touches, touchesByTarget.get(touchEventTarget), changedTouches[state].m_touches.get(),
eventName, touchEventTarget->toNode()->document().domWindow(),
event.getModifiers(), event.cancelable(), event.causesScrollingIfUncanceled(), event.timestamp());
//.........这里部分代码省略.........