PanoramicVideo::PanoramicVideo(ds::ui::SpriteEngine& engine) : ds::ui::Sprite(engine) , mVideoSprite(nullptr) , mInvertX(false) , mInvertY(true) , mXSensitivity(0.15f) , mYSensitivity(0.15f) , mFov(60.0f) , mAutoSync(true) , mPanning(0.0f) , mXRot(0.0f) , mYRot(-90.0f) { mBlobType = _BLOB; setUseShaderTexture(true); setTransparent(true); mSphereVbo = ci::gl::VboMesh::create(ci::geom::Sphere().subdivisions(120).radius(200.0f)); resetCamera(); enable(true); enableMultiTouch(ds::ui::MULTITOUCH_INFO_ONLY); setProcessTouchCallback([this](ds::ui::Sprite*, const ds::ui::TouchInfo& ti){ handleDrag(ci::vec2(ti.mDeltaPoint)); }); }
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper()) dh->DragEnter(reinterpret_cast<HWND>(m_window->winId()), pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect); qCDebug(lcQpaMime) << __FUNCTION__ << "widget=" << m_window << " key=" << grfKeyState << "pt=" << pt.x << pt.y; QWindowsDrag::instance()->setDropDataObject(pDataObj); pDataObj->AddRef(); const QPoint point = QWindowsGeometryHint::mapFromGlobal(m_window, QPoint(pt.x,pt.y)); handleDrag(m_window, grfKeyState, point, pdwEffect); return NOERROR; }
bool QKineticScrollerPrivate::moveWhilePressed(QKineticScroller::Input, const QPointF &position, qint64 timestamp) { Q_Q(QKineticScroller); QPointF deltaPixel = position - pressPosition; bool moveStarted = ((deltaPixel.manhattanLength() / pixelPerMeter) > dragStartDistance); if (moveStarted) { qreal deltaXtoY = qAbs(pressPosition.x() - position.x()) - qAbs(pressPosition.y() - position.y()); deltaXtoY /= pixelPerMeter; QPointF maxPos = q->maximumContentPosition(); bool canScrollX = (maxPos.x() > 0); bool canScrollY = (maxPos.y() > 0); if (hOvershootPolicy == QKineticScroller::OvershootAlwaysOn) canScrollX = true; if (vOvershootPolicy == QKineticScroller::OvershootAlwaysOn) canScrollY = true; if (deltaXtoY < 0) { if (!canScrollY && (!canScrollX || (-deltaXtoY >= dragStartDirectionErrorMargin))) moveStarted = false; } else { if (!canScrollX && (!canScrollY || (deltaXtoY >= dragStartDirectionErrorMargin))) moveStarted = false; } } if (moveStarted) { if (cancelPress) q->cancelPress(pressPosition); setState(QKineticScroller::StateDragging); // subtract the dragStartDistance deltaPixel = deltaPixel - deltaPixel * (dragStartDistance / deltaPixel.manhattanLength()); if (!deltaPixel.isNull()) { // handleDrag updates lastPosition, lastTimestamp and velocity handleDrag(pressPosition + deltaPixel, timestamp); } } return moveStarted; }
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper()) dh->DragOver(reinterpret_cast<POINT*>(&pt), *pdwEffect); qCDebug(lcQpaMime) << __FUNCTION__ << "m_window" << m_window << "key=" << grfKeyState << "pt=" << pt.x << pt.y; const QPoint tmpPoint = QWindowsGeometryHint::mapFromGlobal(m_window, QPoint(pt.x,pt.y)); // see if we should compress this event if ((tmpPoint == m_lastPoint || m_answerRect.contains(tmpPoint)) && m_lastKeyState == grfKeyState) { *pdwEffect = m_chosenEffect; qCDebug(lcQpaMime) << __FUNCTION__ << "compressed event"; return NOERROR; } handleDrag(m_window, grfKeyState, tmpPoint, pdwEffect); return NOERROR; }
int geResizerBar::handle(int e) { int ret = 0; int this_y; if (m_type == VERTICAL) this_y = Fl::event_y_root(); else this_y = Fl::event_x_root(); switch (e) { case FL_FOCUS: ret = 1; break; case FL_ENTER: ret = 1; fl_cursor(m_type == VERTICAL ? FL_CURSOR_NS : FL_CURSOR_WE); m_hover = true; redraw(); break; case FL_LEAVE: ret = 1; fl_cursor(FL_CURSOR_DEFAULT); m_hover = false; redraw(); break; case FL_PUSH: ret = 1; m_lastPos = this_y; break; case FL_DRAG: handleDrag(this_y-m_lastPos); m_lastPos = this_y; ret = 1; break; default: break; } return(Fl_Box::handle(e) | ret); }
bool EngineCore::inputEvent(AInputEvent* event) { bool handled = false; bool doubleTapHandled = false; bool dragHandled = false; bool pinchHandled = false; switch(AInputEvent_getType(event)) { case AINPUT_EVENT_TYPE_KEY: handled = inputKeyEvent(AKeyEvent_getAction(event), AKeyEvent_getKeyCode(event)); break; case AINPUT_EVENT_TYPE_MOTION: { ndk_helper::GESTURE_STATE doubleTapState = mDoubleTapDetector.Detect(event); ndk_helper::GESTURE_STATE dragState = mDragDetector.Detect(event); ndk_helper::GESTURE_STATE pinchState = mPinchDetector.Detect(event); if (doubleTapState == ndk_helper::GESTURE_STATE_ACTION) { doubleTapHandled = handleDoubleTap(); } else { if (dragState & ndk_helper::GESTURE_STATE_START) { ndk_helper::Vec2 v; mDragDetector.GetPointer(v); float x, y; v.Value(x, y); dragHandled = handleDrag(GESTURE_DRAG_START, x, y); } else if (dragState & ndk_helper::GESTURE_STATE_MOVE) { ndk_helper::Vec2 v; mDragDetector.GetPointer(v); float x, y; v.Value(x, y); dragHandled = handleDrag(GESTURE_DRAG_MOVE, x, y); } else if (dragState & ndk_helper::GESTURE_STATE_END) { dragHandled = handleDrag(GESTURE_DRAG_END, 0, 0); } if (pinchState & ndk_helper::GESTURE_STATE_START) { ndk_helper::Vec2 v1; ndk_helper::Vec2 v2; mPinchDetector.GetPointers(v1, v2); float x1, y1, x2, y2; v1.Value(x1, y1); v2.Value(x2, y2); pinchHandled = handlePinch(GESTURE_PINCH_START, x1, y1, x2, y2); } else if (pinchState & ndk_helper::GESTURE_STATE_MOVE) { ndk_helper::Vec2 v1; ndk_helper::Vec2 v2; mPinchDetector.GetPointers(v1, v2); float x1, y1, x2, y2; v1.Value(x1, y1); v2.Value(x2, y2); pinchHandled = handlePinch(GESTURE_PINCH_MOVE, x1, y1, x2, y2); } } if (!doubleTapHandled && !dragHandled && !pinchHandled) handled = inputMotionEvent(AMotionEvent_getAction(event)); break; } default: ALOGW("Unknown input event"); break; } return doubleTapHandled || dragHandled || pinchHandled || handled; }
void TreeView::itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y) { handleDrag (StringArray(), sourceDescription, sourceComponent, x, y); }
void TreeView::fileDragMove (const StringArray& files, int x, int y) { handleDrag (files, String::empty, 0, x, y); }
bool QKineticScrollerPrivate::moveWhileDragging(QKineticScroller::Input, const QPointF &position, qint64 timestamp) { // handleDrag updates lastPosition, lastTimestamp and velocity handleDrag(position, timestamp); return true; }
void ReadWidget::dragEnterEvent(QDragEnterEvent * event) { handleDrag(event); }
///-------------------------------------------------------------- void Scene2::mouseDragged(int x, int y, int button) { handleDrag(InteractionSourceMouse, x, y); }
///-------------------------------------------------------------- void Scene2::tuioReceiverDragged(TUIOReceiverEvent &cursor) { ofVec2f screenCoords = TUIOHandler::tuioToScreenCoords(cursor.x, cursor.y); handleDrag(InteractionSourceTuio, int(screenCoords.x), int(screenCoords.y), cursor.cursorId); }
///-------------------------------------------------------------- void Scene2::tuioDragged(ofTouchEventArgs &touch) { ofVec2f screenCoords = TUIOHandler::tuioToScreenCoords(touch.x, touch.y); handleDrag(InteractionSourceTuio, int(screenCoords.x), int(screenCoords.y), touch.id); }