예제 #1
0
void DrawPointTool::dragMove()
{
	if (preview_object->getSymbol()->asPoint()->isRotatable())
	{
		bool enable_angle_helper = active_modifiers & Qt::ControlModifier;
		if (angle_helper->isActive() != enable_angle_helper)
		{
			angle_helper->setActive(enable_angle_helper, preview_object->getCoordF());
			updateConstrainedPositions();
		}
		
		renderables->removeRenderablesOfObject(preview_object.get(), false);
		preview_object->setRotation(calculateRotation(constrained_pos, constrained_pos_map));
		preview_object->update();
		renderables->insertRenderablesOfObject(preview_object.get());
		updateDirtyRect();
		
		updateStatusText();
	}
}
예제 #2
0
bool RotatePatternTool::keyPressEvent(QKeyEvent* event)
{
    if (event->key() == Qt::Key_Control)
	{
		active_modifiers |= Qt::ControlModifier;
		
		auto active = QGuiApplication::mouseButtons().testFlag(Qt::LeftButton);
		angle_helper->setActive(active, click_pos_map);
		if (isDragging())
		{
			updateConstrainedPositions();
			dragMove();
		}
		else if (active)
		{
			updateDirtyRect(); // for active angle helper
		}
		updateStatusText();
		return true;
	}
	return false;
}
예제 #3
0
bool RotatePatternTool::keyReleaseEvent(QKeyEvent* event)
{
	if (event->key() == Qt::Key_Control)
	{
		active_modifiers &= ~Qt::ControlModifier;
		
		if (angle_helper->isActive())
		{
			if (!isDragging())
			{
				updateDirtyRect();
			}
			angle_helper->setActive(false);
			if (isDragging())
			{
				updateConstrainedPositions();
				dragMove();
			}
		}
		updateStatusText();
		return true;
	}
	return false;
}