mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Absolute delete
This commit is contained in:
parent
9957a0bae0
commit
dbc433dbf7
@ -1229,16 +1229,18 @@ void Viewer::deleteSelected() {
|
||||
|
||||
// Remove Shape from its parent
|
||||
if(selectedObj.shape == nullptr) return;
|
||||
// selectedObj.shape->getParent()->getChildren()->erase(
|
||||
// std::remove(selectedObj.shape->getParent()->getChildren()->begin(),
|
||||
// selectedObj.shape->getParent()->getChildren()->end(),
|
||||
// selection),
|
||||
// selectedObj.shape->getParent()->getChildren()->end());
|
||||
selectedObj.shape->getParent()->getChildren()->erase(
|
||||
std::remove(selectedObj.shape->getParent()->getChildren()->begin(),
|
||||
selectedObj.shape->getParent()->getChildren()->end(),
|
||||
selection),
|
||||
selectedObj.shape->getParent()->getChildren()->end());
|
||||
|
||||
// Get Children if available, and attach to parent
|
||||
if(selectedObj.shape->getParent()->getChildren()->size() > 1) {
|
||||
QMatrix4x4 parentMatrix = QMatrix4x4(selectedObj.shape->getParent()->transform);
|
||||
for(int i = 0; i < selectedObj.shape->getParent()->getChildren()->size(); i++) {
|
||||
if(selectedObj.shape != selectedObj.shape->getParent()->getChildren()->at(i)) {
|
||||
selectedObj.shape->getParent()->getChildren()->at(i)->transform = parentMatrix * selectedObj.shape->getParent()->getChildren()->at(i)->transform;
|
||||
selectedObj.shape->getParent()->getParent()->addChild(selectedObj.shape->getParent()->getChildren()->at(i));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user