本文整理汇总了C++中TouchList::length方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchList::length方法的具体用法?C++ TouchList::length怎么用?C++ TouchList::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchList
的用法示例。
在下文中一共展示了TouchList::length方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleTouchEvent
void PluginView::handleTouchEvent(TouchEvent* event)
{
if (!m_private)
return;
if (!m_private->m_isFocused)
focusPluginElement();
NPTouchEvent npTouchEvent;
if (event->isDoubleTap())
npTouchEvent.type = TOUCH_EVENT_DOUBLETAP;
else if (event->isTouchHold())
npTouchEvent.type = TOUCH_EVENT_TOUCHHOLD;
else if (event->type() == eventNames().touchcancelEvent)
npTouchEvent.type = TOUCH_EVENT_CANCEL;
else
return;
TouchList* touchList;
// The touches list is empty if in a touch end event.
// Since DoubleTap is ususally a TouchEnd Use changedTouches instead.
if (npTouchEvent.type == TOUCH_EVENT_DOUBLETAP)
touchList = event->changedTouches();
else
touchList = event->touches();
npTouchEvent.points = 0;
npTouchEvent.size = touchList->length();
OwnArrayPtr<NPTouchPoint> touchPoints;
if (touchList->length()) {
touchPoints = adoptArrayPtr(new NPTouchPoint[touchList->length()]);
npTouchEvent.points = touchPoints.get();
for (unsigned i = 0; i < touchList->length(); i++) {
Touch* touchItem = touchList->item(i);
touchPoints[i].touchId = touchItem->identifier();
touchPoints[i].clientX = touchItem->pageX() - frameRect().x();
touchPoints[i].clientY = touchItem->pageY() - frameRect().y();
touchPoints[i].screenX = touchItem->screenX();
touchPoints[i].screenY = touchItem->screenY();
touchPoints[i].pageX = touchItem->pageX();
touchPoints[i].pageY = touchItem->pageY();
}
}
NPEvent npEvent;
npEvent.type = NP_TouchEvent;
npEvent.data = &npTouchEvent;
if (dispatchNPEvent(npEvent))
event->setDefaultHandled();
}
示例2: handleTouchEvent
void PluginView::handleTouchEvent(TouchEvent* event)
{
if (!m_window->isAcceptingEvent(kTouch_ANPEventFlag))
return;
if (!m_window->inFullScreen() && m_parentFrame->document()->focusedNode() != m_element)
return;
ANPEvent evt;
SkANP::InitEvent(&evt, kMultiTouch_ANPEventType);
const AtomicString& type = event->type();
if (eventNames().touchstartEvent == type)
evt.data.multiTouch.action = kDown_ANPTouchAction;
else if (eventNames().touchendEvent == type)
evt.data.multiTouch.action = kUp_ANPTouchAction;
else if (eventNames().touchmoveEvent == type)
evt.data.multiTouch.action = kMove_ANPTouchAction;
else if (eventNames().touchcancelEvent == type)
evt.data.multiTouch.action = kCancel_ANPTouchAction;
else if (eventNames().touchlongpressEvent == type)
evt.data.multiTouch.action = kLongPress_ANPTouchAction;
else if (eventNames().touchdoubletapEvent == type)
evt.data.multiTouch.action = kDoubleTap_ANPTouchAction;
else
return;
// set the id and timestamp
evt.data.multiTouch.id = 0; // TODO
evt.data.multiTouch.timestamp = 0; // TODO
// In the event of a touchend (up) or touchcancel event, we must ask the changedTouch for the
// co-ordinates as there is no touch in touches anymore.
TouchList* touches = (evt.data.multiTouch.action == kUp_ANPTouchAction
|| evt.data.multiTouch.action == kCancel_ANPTouchAction) ? event->changedTouches() : event->touches();
// set each touchPoint
int pointerCount = touches->length();
evt.data.multiTouch.pointerCount = pointerCount;
evt.data.multiTouch.touchPoint = new TouchPoint[pointerCount];
for (int x = 0; x < evt.data.multiTouch.pointerCount; x++) {
Touch* touch = touches->item(x);
// Convert to coordinates that are relative to the plugin.
IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(IntPoint(touch->pageX(), touch->pageY())));
evt.data.multiTouch.touchPoint[x].id = touch->identifier();
evt.data.multiTouch.touchPoint[x].x = localPos.x();
evt.data.multiTouch.touchPoint[x].y = localPos.y();
evt.data.multiTouch.touchPoint[x].pressure = 1; // TODO
evt.data.multiTouch.touchPoint[x].size = 1; // TODO
}
if (m_window->sendEvent(evt))
event->preventDefault();
// cleanup the touch points we allocated
delete[] evt.data.multiTouch.touchPoint;
}
示例3: jsTouchListLength
JSValue jsTouchListLength(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTouchList* castedThis = static_cast<JSTouchList*>(asObject(slotBase));
UNUSED_PARAM(exec);
TouchList* imp = static_cast<TouchList*>(castedThis->impl());
JSValue result = jsNumber(imp->length());
return result;
}
示例4: handleTouchStart
void SliderThumbElement::handleTouchStart(TouchEvent* touchEvent)
{
TouchList* targetTouches = touchEvent->targetTouches();
if (targetTouches->length() != 1)
return;
// Ignore the touch if it is not really inside the thumb.
Touch* touch = targetTouches->item(0);
IntRect boundingBox = renderer()->absoluteBoundingBoxRect();
if (!boundingBox.contains(touch->pageX(), touch->pageY()))
return;
setExclusiveTouchIdentifier(touch->identifier());
startDragging();
touchEvent->setDefaultHandled();
}
示例5: handleTouchEvent
void RangeInputType::handleTouchEvent(TouchEvent* event)
{
#if PLATFORM(IOS)
typedSliderThumbElement().handleTouchEvent(event);
#elif ENABLE(TOUCH_SLIDER)
if (element().isDisabledOrReadOnly())
return;
if (event->type() == eventNames().touchendEvent) {
event->setDefaultHandled();
return;
}
TouchList* touches = event->targetTouches();
if (touches->length() == 1) {
typedSliderThumbElement().setPositionFromPoint(touches->item(0)->absoluteLocation());
event->setDefaultHandled();
}
#endif
}
示例6: checkReachability
void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList)
{
for (size_t i = 0; i < touchList.length(); ++i)
ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope));
}