本文整理汇总了C++中EventPath::shrink方法的典型用法代码示例。如果您正苦于以下问题:C++ EventPath::shrink方法的具体用法?C++ EventPath::shrink怎么用?C++ EventPath::shrink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventPath
的用法示例。
在下文中一共展示了EventPath::shrink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateAdjustedNodes
void EventRetargeter::calculateAdjustedNodes(const Node* node, const Node* relatedNode, EventWithRelatedTargetDispatchBehavior eventWithRelatedTargetDispatchBehavior, EventPath& eventPath, AdjustedNodes& adjustedNodes)
{
RelatedNodeMap relatedNodeMap;
buildRelatedNodeMap(relatedNode, relatedNodeMap);
// Synthetic mouse events can have a relatedTarget which is identical to the target.
bool targetIsIdenticalToToRelatedTarget = (node == relatedNode);
TreeScope* lastTreeScope = 0;
Node* adjustedNode = 0;
for (EventPath::const_iterator iter = eventPath.begin(); iter < eventPath.end(); ++iter) {
TreeScope* scope = (*iter)->node()->treeScope();
if (scope == lastTreeScope) {
// Re-use the previous adjustedRelatedTarget if treeScope does not change. Just for the performance optimization.
adjustedNodes.append(adjustedNode);
} else {
adjustedNode = findRelatedNode(scope, relatedNodeMap);
adjustedNodes.append(adjustedNode);
}
lastTreeScope = scope;
if (eventWithRelatedTargetDispatchBehavior == DoesNotStopAtBoundary)
continue;
if (targetIsIdenticalToToRelatedTarget) {
if (node->treeScope()->rootNode() == (*iter)->node()) {
eventPath.shrink(iter + 1 - eventPath.begin());
break;
}
} else if ((*iter)->target() == adjustedNode) {
// Event dispatching should be stopped here.
eventPath.shrink(iter - eventPath.begin());
adjustedNodes.shrink(adjustedNodes.size() - 1);
break;
}
}
}