Gui: Fix regression pointed out in review
paddlestroke:
> Here we actually need to keep App::Origin. Because we do not allow deletion ONLY of origin objects. Not of normal LCS.
While the original code:
```cpp
auto origin = dynamic_cast<App::Origin*>(lcs);
if (origin && !origin->getInList().empty()) {
```
...handles this perfectly fine, intent isn't obvious when reading it.
Using `is<T>()` shows intent better and should avoid similar situations in the future.
This commit is contained in:
@@ -227,7 +227,7 @@ bool ViewProviderCoordinateSystem::onDelete(const std::vector<std::string> &)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lcs && !lcs->getInList().empty()) {
|
||||
if (lcs->is<App::Origin>() && !lcs->getInList().empty()) {
|
||||
// Do not allow deletion of origin objects that are not lost.
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user