154 LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); |
154 LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); |
155 |
155 |
156 if (mo) |
156 if (mo) |
157 { |
157 { |
158 Vertex v = mo->position(); |
158 Vertex v = mo->position(); |
159 Matrix t = mo->transform(); |
159 Matrix t = mo->transformationMatrix(); |
160 |
160 |
161 v.apply ([&](Axis, double& a) |
161 v.apply ([&](Axis, double& a) |
162 { |
162 { |
163 RoundToDecimals (a, m_config->roundPositionPrecision()); |
163 RoundToDecimals (a, m_config->roundPositionPrecision()); |
164 }); |
164 }); |
167 { |
167 { |
168 RoundToDecimals (a, m_config->roundMatrixPrecision()); |
168 RoundToDecimals (a, m_config->roundMatrixPrecision()); |
169 }); |
169 }); |
170 |
170 |
171 mo->setPosition (v); |
171 mo->setPosition (v); |
172 mo->setTransform (t); |
172 mo->setTransformationMatrix (t); |
173 num += 12; |
173 num += 12; |
174 } |
174 } |
175 else |
175 else if (obj->hasVertices()) |
176 { |
176 { |
177 for (int i = 0; i < obj->numVertices(); ++i) |
177 LDVertexObject* vo = static_cast<LDVertexObject*> (obj); |
178 { |
178 for (int i = 0; i < vo->numVertices(); ++i) |
179 Vertex v = obj->vertex (i); |
179 { |
|
180 Vertex v = vo->vertex (i); |
180 v.apply ([&](Axis, double& a) |
181 v.apply ([&](Axis, double& a) |
181 { |
182 { |
182 RoundToDecimals (a, m_config->roundPositionPrecision()); |
183 RoundToDecimals (a, m_config->roundPositionPrecision()); |
183 }); |
184 }); |
184 obj->setVertex (i, v); |
185 vo->setVertex (i, v); |
185 num += 3; |
186 num += 3; |
186 } |
187 } |
187 } |
188 } |
188 } |
189 } |
189 |
190 |
212 if (ui.y->isChecked()) sel << Y; |
213 if (ui.y->isChecked()) sel << Y; |
213 if (ui.z->isChecked()) sel << Z; |
214 if (ui.z->isChecked()) sel << Z; |
214 |
215 |
215 for (LDObject* obj : selectedObjects()) |
216 for (LDObject* obj : selectedObjects()) |
216 { |
217 { |
|
218 if (not obj->hasVertices()) |
|
219 continue; |
|
220 |
|
221 LDVertexObject* vo = static_cast<LDVertexObject*> (obj); |
217 for (int i = 0; i < obj->numVertices(); ++i) |
222 for (int i = 0; i < obj->numVertices(); ++i) |
218 { |
223 { |
219 Vertex v = obj->vertex (i); |
224 Vertex v = obj->vertex (i); |
220 |
225 |
221 v.apply ([&](Axis ax, double& coord) |
226 v.apply ([&](Axis ax, double& coord) |
573 // Add a reference to the new subfile to where the selection was |
578 // Add a reference to the new subfile to where the selection was |
574 LDSubfile* ref = LDSpawn<LDSubfile>(); |
579 LDSubfile* ref = LDSpawn<LDSubfile>(); |
575 ref->setColor (MainColor); |
580 ref->setColor (MainColor); |
576 ref->setFileInfo (doc); |
581 ref->setFileInfo (doc); |
577 ref->setPosition (Origin); |
582 ref->setPosition (Origin); |
578 ref->setTransform (IdentityMatrix); |
583 ref->setTransformationMatrix (IdentityMatrix); |
579 currentDocument()->insertObj (refidx, ref); |
584 currentDocument()->insertObj (refidx, ref); |
580 |
585 |
581 // Refresh stuff |
586 // Refresh stuff |
582 m_window->updateDocumentList(); |
587 m_window->updateDocumentList(); |
583 m_window->doFullRefresh(); |
588 m_window->doFullRefresh(); |