src/document.cpp

changeset 118
8e1c9f18ae15
parent 117
121a40d5e34c
child 121
000781318c36
--- a/src/document.cpp	Tue Jul 27 13:23:34 2021 +0300
+++ b/src/document.cpp	Tue Jul 27 16:29:00 2021 +0300
@@ -31,10 +31,10 @@
 	model{model},
 	documents{documents},
 	colorTable{colorTable},
+	vertexMap{model},
 	renderer{new Canvas{model, documents, colorTable, this}},
 	ui{*new Ui::Document},
-	objectEditor{model, ldraw::NULL_ID, this},
-	vertexMap{model}
+	objectEditor{model, ldraw::NULL_ID, this}
 {
 	this->ui.setupUi(this);
 	this->ui.listView->setModel(model);
@@ -81,6 +81,10 @@
 	{
 		Q_EMIT this->mouseMove(this, canvas);
 	});
+	connect(&this->vertexMap, &VertexMap::verticesChanged, [&]()
+	{
+		this->renderer->rebuildVertices(this);
+	});
 }
 
 Document::~Document()
@@ -113,6 +117,11 @@
 	return this->model->edit();
 }
 
+void Document::applyToVertices(VertexMap::ApplyFunction fn) const
+{
+	this->vertexMap.apply(fn);
+}
+
 void Document::selectionChanged(const QSet<ldraw::id_t>& newSelection)
 {
 	if (newSelection.size() == 1)

mercurial