コード例 #1
0
ファイル: mgdrawlines.cpp プロジェクト: huangzongwu/touchvg
bool MgCmdDrawFreeLines::touchMoved(const MgMotion* sender)
{
    MgBaseLines* lines = (MgBaseLines*)dynshape()->shape();
    
    float closelen  = mgLineHalfWidthModel(dynshape(), sender) + mgDisplayMmToModel(5, sender);
    float closedist = sender->pointM.distanceTo(dynshape()->shape()->getPoint(0));
    bool  closed    = (m_step > 2 && closedist < closelen
        && dynshape()->shape()->getExtent().width() > closedist * 1.5f
        && dynshape()->shape()->getExtent().height() > closedist * 1.5f);
    
    if (m_step > 2 && dynshape()->shape()->isClosed() != closed) {
        lines->setClosed(closed);
        if (closed)
            lines->removePoint(m_step);
        else
            lines->addPoint(sender->pointM);
    }
    if (!closed) {
        dynshape()->shape()->setPoint(m_step, sender->pointM);
        if (m_step > 0 && canAddPoint(sender, false)) {
            m_step++;
            if (m_step >= dynshape()->shape()->getPointCount()) {
                ((MgBaseLines*)dynshape()->shape())->addPoint(sender->pointM);
            }
        }
    }
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #2
0
ファイル: mgdrawtriang.cpp プロジェクト: fanliugen/touchvg
bool MgCmdDrawTriangle::touchMoved(const MgMotion* sender)
{
    dynshape()->shape()->setPoint(m_step, snapPoint(sender));
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #3
0
ファイル: mgdrawtriang.cpp プロジェクト: fanliugen/touchvg
bool MgCmdParallelogram::touchMoved(const MgMotion* sender)
{
    dynshape()->shape()->setHandlePoint(m_step, snapPoint(sender), 0);
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #4
0
ファイル: mgcmddraw.cpp プロジェクト: thinkfeed/touchvg
bool MgCommandDraw::_touchMoved2(const MgMotion* sender)
{
    setStepPoint(m_step, snapPoint(sender));
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #5
0
ファイル: mgdrawrect.cpp プロジェクト: thinkfeed/touchvg
bool MgCmdDrawRect::touchMoved(const MgMotion* sender)
{
    Point2d pt1(m_startPt);
    Point2d pt2(snapPoint(sender));
    MgBaseRect* shape = (MgBaseRect*)dynshape()->shape();
    
    shape->setRect2P(pt1, pt2);
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #6
0
ファイル: mgdrawrect.cpp プロジェクト: thinkfeed/touchvg
bool MgCmdDrawGrid::touchMoved(const MgMotion* sender)
{
    if (m_step == 1) {
        return MgCmdDrawRect::touchMoved(sender);
    }
    
    dynshape()->shape()->setHandlePoint(8, snapPoint(sender), 0);
    dynshape()->shape()->update();
    
    return _touchMoved(sender);
}
コード例 #7
0
ファイル: GuiControl.cpp プロジェクト: imclab/24HourMusic
//--------------------------------------------------------------
bool GuiControl::_touchUp(int _x, int _y, int button){
	if(!enabled) return false;
	over = hitTest(_x, _y);
	down = false;
	if(editing) {
		_touchMoved (_x, _y, button);
	} else {
		if(over) touchUp(_x, _y, button);
	}
	editState = EDIT_NONE;
	return over;
}
コード例 #8
0
ファイル: mgdrawsplines.cpp プロジェクト: lincleejun/touchvg
bool MgCmdDrawSplines::touchMoved(const MgMotion* sender)
{
    MgBaseLines* lines = (MgBaseLines*)dynshape()->shape();
    
    dynshape()->shape()->setPoint(m_step, sender->pointM);
    if (m_step > 0 && canAddPoint(sender, false)) {
        m_step++;
        if (m_step >= dynshape()->shape()->getPointCount()) {
            lines->addPoint(sender->pointM);
        }
    }
    dynshape()->shape()->update();
    
    return _touchMoved(sender);
}
コード例 #9
0
ファイル: mgdrawlines.cpp プロジェクト: huangzongwu/touchvg
bool MgCmdDrawLines::touchMoved(const MgMotion* sender)
{
    Point2d pnt(snapPoint(sender));
    dynshape()->shape()->setPoint(m_step, pnt);
    
    if (needCheckClosed()) {
        float distmin = mgDisplayMmToModel(2.f, sender);
        bool closed = m_step > 2 && pnt.distanceTo(dynshape()->shape()->getPoint(0)) < distmin;
        ((MgBaseLines*)dynshape()->shape())->setClosed(closed);
    }
    
    dynshape()->shape()->update();
    
    return _touchMoved(sender);
}
コード例 #10
0
ファイル: mgdrawrect.cpp プロジェクト: fanliugen/touchvg
bool MgCmdDrawRect::touchMoved(const MgMotion* sender)
{
    Point2d pt1(m_startPt);
    Point2d pt2(snapPoint(sender));
    MgBaseRect* shape = (MgBaseRect*)dynshape()->shape();
    
    if (shape->getFlag(kMgSquare)) {
        float len = (float)mgMax(fabs(pt2.x - pt1.x), fabs(pt2.y - pt1.y));
        Box2d rect(m_startPt, 2.f * len, 0);
        pt1 = rect.leftTop();
        pt2 = rect.rightBottom();
    }
    shape->setRect(pt1, pt2);
    dynshape()->shape()->update();

    return _touchMoved(sender);
}
コード例 #11
0
ファイル: mgdrawsplines.cpp プロジェクト: lincleejun/touchvg
bool MgCmdDrawSplines::touchBegan(const MgMotion* sender)
{
    MgBaseLines* lines = (MgBaseLines*)dynshape()->shape();
    
    if (m_step > 0 && !m_freehand) {
        m_step++;
        if (m_step >= dynshape()->shape()->getPointCount()) {
            lines->addPoint(sender->pointM);
            dynshape()->shape()->update();
        }
        
        return _touchMoved(sender);
    }
    else {
        lines->resize(2);
        m_freehand = !sender->pressDrag;
        m_step = 1;
        dynshape()->shape()->setPoint(0, sender->startPointM);
        dynshape()->shape()->setPoint(1, sender->pointM);
        dynshape()->shape()->update();
        
        return _touchBegan(sender);
    }
}