You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#include "StdAfx.h"
|
|
#include "MouseToolMove.h"
|
|
#include "GlobalDrawMgr.h"
|
|
#include "GlobalFunction.h"
|
|
|
|
|
|
CMouseToolMove::CMouseToolMove(void)
|
|
{
|
|
m_MoveDisX = 0;
|
|
m_MoveDisY = 0;
|
|
}
|
|
CMouseToolMove::~CMouseToolMove(void)
|
|
{
|
|
}
|
|
void CMouseToolMove::OnLButtonDown(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
if(m_Status==_STATUS_1)
|
|
{
|
|
SaveDownPoint(point);
|
|
//创建模拟操作的对象
|
|
CreatOpSimulateObj();
|
|
ToNextStatus();
|
|
}
|
|
}
|
|
void CMouseToolMove::OnLButtonUp(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
gLayer.OnMove(m_MoveDisX,m_MoveDisY);
|
|
OperateOver();
|
|
m_Status = _STATUS_END;
|
|
}
|
|
void CMouseToolMove::OperateObj(Dbxy StartPt,Dbxy EndPt)
|
|
{
|
|
//obj 操作
|
|
SObjOperatePar par;
|
|
par.OpType = _OP_MOVE;
|
|
par.MoveX = EndPt.x - StartPt.x;
|
|
par.MoveY = EndPt.y - StartPt.y;
|
|
//操作模拟对象
|
|
OpSimulateObj(par);
|
|
|
|
//记录移动距离---撤销用
|
|
m_MoveDisX = par.MoveX;
|
|
m_MoveDisY = par.MoveY;
|
|
}
|
|
void CMouseToolMove::OnMouseMove(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
Dbxy CurPt = gDraw->CPoint2Dbxy(point);
|
|
CLayer &layer = gLayer;
|
|
if(nFlags&MK_LBUTTON && (m_Status!=_STATUS_1))
|
|
{
|
|
if(m_bFirstMove==false)
|
|
{
|
|
//重绘模拟对象
|
|
XorRedrawOpSimulateObj(&dc);
|
|
}
|
|
m_bFirstMove = false;
|
|
OperateObj(m_DownPoint,CurPt);//操作
|
|
XorRedrawOpSimulateObj(&dc);
|
|
}
|
|
}
|
|
|