本文整理汇总了C++中Touch::screenX方法的典型用法代码示例。如果您正苦于以下问题:C++ Touch::screenX方法的具体用法?C++ Touch::screenX怎么用?C++ Touch::screenX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Touch
的用法示例。
在下文中一共展示了Touch::screenX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsTouchScreenX
JSValue jsTouchScreenX(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
UNUSED_PARAM(exec);
Touch* imp = static_cast<Touch*>(castedThis->impl());
JSValue result = jsNumber(imp->screenX());
return result;
}
示例2: 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();
}