mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Fix disable delete layer button when only one layer exists (fix #3649)
This commit is contained in:
parent
fc29686bb2
commit
ea35725c85
@ -116,9 +116,20 @@ RemoveLayerCommand::RemoveLayerCommand()
|
||||
|
||||
bool RemoveLayerCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::HasActiveSprite |
|
||||
ContextFlags::HasActiveLayer);
|
||||
if (!context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::HasActiveSprite |
|
||||
ContextFlags::HasActiveLayer))
|
||||
return false;
|
||||
|
||||
const ContextReader reader(context);
|
||||
const Sprite* sprite(reader.sprite());
|
||||
const Layer* layer = reader.layer();
|
||||
|
||||
return sprite && layer &&
|
||||
// We can remove all layers from non-root groups
|
||||
((layer->parent() != sprite->root()) ||
|
||||
// Check that we are not removing the last layer in the sprite
|
||||
(sprite->root()->layersCount() > 1));
|
||||
}
|
||||
|
||||
void RemoveLayerCommand::onExecute(Context* context)
|
||||
|
Loading…
Reference in New Issue
Block a user