Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Alignment #369

Open
LiuPeiqiCN opened this issue Feb 8, 2023 · 0 comments
Open

Node Alignment #369

LiuPeiqiCN opened this issue Feb 8, 2023 · 0 comments

Comments

@LiuPeiqiCN
Copy link

Commit 8a41b1c broken node alignment, new MoveNodeCommand(BasicGraphicsScene* scene, NodeId const nodeId, QPointF const &diff) has been deleted.

// Align-Top
connect(ui.btnAlignTop, &QPushButton::clicked,
	[=] {
		if (scene->selectedNodes().size() > 0)
		{
			auto nodeIds = scene->selectedNodes();

			qreal minY = DBL_MAX;
			for (size_t i = 0; i < nodeIds.size(); i++)
				minY = qMin(scene->nodeGraphicsObject(nodeIds[i])->y(), minY);

			for (size_t i = 0; i < nodeIds.size(); i++) {
				auto oldPos = scene->graphModel().nodeData(nodeIds[i], NodeRole::Position).value<QPointF>();
				if (minY != oldPos.y())
				{
					scene->nodeGraphicsObject(nodeIds[i])->setY(minY);

					// !!!!!! This function has been deleted in the latest commit
					//scene->undoStack().push(new MoveNodeCommand(scene, nodeIds[i], QPointF(0, minY - oldPos.y())));
				}
			}
		}
	});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant