mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Fixed updating of undo state on deleting item in photo editor.
This commit is contained in:
@@ -138,6 +138,12 @@ Paint::Paint(
|
|||||||
clearRedoList();
|
clearRedoList();
|
||||||
updateUndoState();
|
updateUndoState();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
_scene->removesItem(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
updateUndoState();
|
||||||
|
}, lifetime());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Paint::applyTransform(QRect geometry, int angle, bool flipped) {
|
void Paint::applyTransform(QRect geometry, int angle, bool flipped) {
|
||||||
|
@@ -67,6 +67,7 @@ void Scene::removeItem(not_null<QGraphicsItem*> item) {
|
|||||||
|
|
||||||
void Scene::removeItem(const ItemPtr &item) {
|
void Scene::removeItem(const ItemPtr &item) {
|
||||||
_items.erase(ranges::remove(_items, item), end(_items));
|
_items.erase(ranges::remove(_items, item), end(_items));
|
||||||
|
_removesItem.fire({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
@@ -101,6 +102,10 @@ rpl::producer<> Scene::addsItem() const {
|
|||||||
return _addsItem.events();
|
return _addsItem.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<> Scene::removesItem() const {
|
||||||
|
return _removesItem.events();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<ItemPtr> Scene::items(
|
std::vector<ItemPtr> Scene::items(
|
||||||
Qt::SortOrder order) const {
|
Qt::SortOrder order) const {
|
||||||
auto copyItems = _items;
|
auto copyItems = _items;
|
||||||
|
@@ -36,6 +36,7 @@ public:
|
|||||||
void removeItem(not_null<QGraphicsItem*> item);
|
void removeItem(not_null<QGraphicsItem*> item);
|
||||||
void removeItem(const ItemPtr &item);
|
void removeItem(const ItemPtr &item);
|
||||||
[[nodiscard]] rpl::producer<> addsItem() const;
|
[[nodiscard]] rpl::producer<> addsItem() const;
|
||||||
|
[[nodiscard]] rpl::producer<> removesItem() const;
|
||||||
|
|
||||||
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ private:
|
|||||||
float64 _lastLineZ = 0.;
|
float64 _lastLineZ = 0.;
|
||||||
int _itemNumber = 0;
|
int _itemNumber = 0;
|
||||||
|
|
||||||
rpl::event_stream<> _addsItem;
|
rpl::event_stream<> _addsItem, _removesItem;
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user