bool MgCommandDraw::_touchEnded2(const MgMotion* sender) { Point2d pnt(snapPoint(sender)); float distmin = mgDisplayMmToModel(2.f, sender); setStepPoint(m_step, pnt); dynshape()->shape()->update(); if (pnt.distanceTo(dynshape()->shape()->getPoint(m_step - 1)) > distmin) { m_step++; if (m_step >= getMaxStep()) { _addshape(sender); _delayClear(); m_step = 0; } } return _touchEnded(sender); }
bool MgCommandDraw::touchEndedStep(const MgMotion* sender) { Point2d pnt(snapPoint(sender)); Tol tol(sender->displayMmToModel(2.f)); setStepPoint(m_step, pnt); dynshape()->shape()->update(); if (!pnt.isEqualTo(dynshape()->shape()->getPoint(m_step - 1), tol)) { m_step++; if (m_step >= getMaxStep()) { if (!dynshape()->shape()->getExtent().isEmpty(tol, false)) { addShape(sender); delayClear(); } m_step = 0; } } return MgCommandDraw::touchEnded(sender); }