bool GiCoreViewImpl::gestureToCommand(const MgMotion& motion) { MgDynShapeLock locker(true, motion.view); MgCommand* cmd = _cmds->getCommand(); bool ret = false; if (motion.gestureState == kMgGestureCancel || !cmd) { return cmd && cmd->cancel(&motion); } if (motion.gestureState == kMgGesturePossible && motion.gestureType != kGiTwoFingersMove) { return true; } switch (motion.gestureType) { case kGiTwoFingersMove: ret = cmd->twoFingersMove(&motion); break; case kGiGesturePan: switch (motion.gestureState) { case kMgGestureBegan: ret = cmd->touchBegan(&motion); break; case kMgGestureMoved: ret = cmd->touchMoved(&motion); break; case kMgGestureEnded: default: ret = cmd->touchEnded(&motion); break; } break; case kGiGestureTap: ret = cmd->click(&motion); break; case kGiGestureDblTap: ret = cmd->doubleClick(&motion); break; case kGiGesturePress: ret = cmd->longPress(&motion); break; } if (!ret) { LOGD("The current command (%s) don't support #%d gesture (state=%d)", cmd->getName(), motion.gestureType, motion.gestureState); } return ret; }
void CDrawShapeView::OnContextMenu(CWnd*, CPoint point) { MgCommand* cmd = mgGetCommandManager()->getCommand(); if (point.x > 0 && point.y > 0) { ScreenToClient(&point); m_proxy->motion.point = Point2d((float)point.x, (float)point.y); m_proxy->motion.pointM = m_proxy->motion.point * m_graph->xf.displayToModel(); } if (cmd) { cmd->longPress(&m_proxy->motion); } else { int actions[] = { 0 }; showContextActions(actions); } }
bool TransformCmd::longPress(const MgMotion* sender) { return _lastCmd && _lastCmd->longPress(sender); }