예제 #1
0
void hdDragCreationTool::mouseDrag(hdMouseEvent &event)
{
	if(event.LeftIsDown())
	{
		figurePrototype->displayBox().SetPosition(event.getView()->getIdx(), event.GetPosition());
	}
}
예제 #2
0
void hdDragTrackerTool::mouseDrag(hdMouseEvent &event)
{
	hdAbstractTool::mouseDrag(event);

	if(event.LeftIsDown())
	{
		int x = event.GetPosition().x, y = event.GetPosition().y;

		//Hack to avoid a weird bug that ocurrs when use double click very fast over figure and drag a same time, lastX
		//and lastY values becomes big negatives numbers, if this happens, then reset it to click point
		if(lastX < 0)
			lastX = x;
		if(lastY < 0)
			lastY = y;

		hasMovedValue = (abs (x - anchorX) > 4 || abs (y - anchorX) > 4);

		if (hasMoved())
		{
			hdIFigure *tmp = NULL;
			hdIteratorBase *iterator = event.getView()->getDrawing()->selectionFigures();
			while(iterator->HasNext())
			{
				tmp = (hdIFigure *)iterator->Next();
				tmp->moveBy(event.getView()->getIdx(), x - lastX, y - lastY);
				event.getView()->notifyChanged();
			}
			delete iterator;
		}
		setLastCoords (x, y);
	}
}
예제 #3
0
void hdSelectAreaTool::mouseDrag(hdMouseEvent &event)
{
	hdAbstractTool::mouseDrag(event);
	if(event.LeftIsDown())
	{
		drawSelectionRect(event.getView());
		int x = event.GetPosition().x, y = event.GetPosition().y;
		selectionRect.x = anchorX;
		selectionRect.y = anchorY;
		selectionRect.SetBottomRight(wxPoint(x, y));
		drawSelectionRect(event.getView());
		event.getView()->ScrollToMakeVisible(event.GetPosition());
	}
}