Skip to content

Commit

Permalink
Fix Editor::canPaste() conditions
Browse files Browse the repository at this point in the history
- Warning: '==' unsafe mix of type 'Layer::LAYER_TYPE' and type 'bool' in operation
  • Loading branch information
chchwy committed Mar 8, 2022
1 parent 0467c63 commit de0a5c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core_lib/src/interface/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,8 @@ bool Editor::canPaste() const
Layer* layer = layers()->currentLayer();
auto clipboardMan = clipboards();
auto layerType = layer->type();
return (layerType == clipboardMan->framesTypeChanged(layer) && clipboardMan->framesIsEmpty()) ||

return (layerType == clipboardMan->framesLayerType() && !clipboardMan->framesIsEmpty()) ||
(layerType == Layer::BITMAP && clipboardMan->getBitmapClipboard().isLoaded()) ||
(layerType == Layer::VECTOR && !clipboardMan->getVectorClipboard().isEmpty());
}
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/managers/clipboardmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ClipboardManager: public BaseManager
VectorImage getVectorClipboard() const { return mVectorImage; }
std::map<int, KeyFrame*> getClipboardFrames() { return mFrames; }

bool framesTypeChanged(const Layer* layer) const { return layer->type() != mFramesType; }
bool framesLayerType() const { return mFramesType; }
bool framesIsEmpty() const { return mFrames.empty(); }

private:
Expand Down

0 comments on commit de0a5c8

Please sign in to comment.