//-----------------------------------------------------------------------------
// Purpose: Handles left mouse button down events in the 2D view.
// Input  : Per CWnd::OnLButtonDown.
// Output : Returns true if the message was handled, false if not.
//-----------------------------------------------------------------------------
bool Clipper3D::OnLMouseDown2D(CMapView2D *pView, UINT nFlags, CPoint point)
{
	CMapDoc *pDoc = pView->GetDocument();
	CMapWorld *pWorld = pDoc->GetMapWorld();

	m_ptLDownClient = point;
	m_bLButtonDown = true;

	pView->SetCapture();

	//
	// Convert to some odd coordinate space that the base tools code uses.
	//
  	CPoint ptScreen = point;
	ptScreen.x += pView->GetScrollPos(SB_HORZ);
	ptScreen.y += pView->GetScrollPos(SB_VERT);
	
	//
	// Convert point to world coords.
	//
	pView->ClientToWorld(point);

	Vector ptOrg( COORD_NOTINIT, COORD_NOTINIT, COORD_NOTINIT );
	ptOrg[axHorz] = point.x;
	ptOrg[axVert] = point.y;

	// getvisiblepoint fills in any coord that's still set to COORD_NOTINIT:
	pDoc->GetBestVisiblePoint(ptOrg);

	// snap starting position to grid
	if (!(GetAsyncKeyState(VK_MENU) & 0x8000))
	{
		pDoc->Snap(ptOrg);
	}
	
	BOOL bStarting = FALSE;

	// if the tool is not empty, and shift is not held down (to
	//  start a new camera), don't do anything.
	if(!IsEmpty())
	{
		if(!StartTranslation(ptScreen))
		{
			if (nFlags & MK_SHIFT)
			{
				SetEmpty();
				bStarting = TRUE;
			}
			else
			{
				goto _DoNothing;
			}
		}
	}
	else
	{
		bStarting = TRUE;
	}

	SetClipObjects(pDoc->Selection_GetList());

	if (bStarting)
	{
		StartNew(ptOrg);
		pView->SetUpdateFlag(CMapView2D::updTool);
	}

_DoNothing:

	return true;
}