本文整理汇总了C++中Touch::pageX方法的典型用法代码示例。如果您正苦于以下问题:C++ Touch::pageX方法的具体用法?C++ Touch::pageX怎么用?C++ Touch::pageX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Touch
的用法示例。
在下文中一共展示了Touch::pageX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: jsTouchPageX
JSValue jsTouchPageX(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->pageX());
return result;
}
示例3: handleTouchMove
void SliderThumbElement::handleTouchMove(TouchEvent* touchEvent)
{
unsigned identifier = exclusiveTouchIdentifier();
if (identifier == NoIdentifier)
return;
Touch* touch = findTouchWithIdentifier(touchEvent->targetTouches(), identifier);
if (!touch)
return;
if (m_inDragMode)
setPositionFromPoint(IntPoint(touch->pageX(), touch->pageY()));
touchEvent->setDefaultHandled();
}
示例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 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;
}