mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed line drawing on mode switching in photo editor.
This commit is contained in:
parent
a91efd9164
commit
9dacf69d41
5 changed files with 16 additions and 0 deletions
|
@ -176,6 +176,7 @@ std::shared_ptr<Scene> Paint::saveScene() const {
|
|||
|
||||
void Paint::cancel() {
|
||||
_scene->clearSelection();
|
||||
_scene->cancelDrawing();
|
||||
|
||||
const auto filtered = _scene->items(Qt::AscendingOrder);
|
||||
if (filtered.empty()) {
|
||||
|
@ -199,6 +200,7 @@ void Paint::cancel() {
|
|||
|
||||
void Paint::keepResult() {
|
||||
_scene->clearSelection();
|
||||
_scene->cancelDrawing();
|
||||
|
||||
for (const auto &item : _itemsToRemove) {
|
||||
_scene->removeItem(item);
|
||||
|
|
|
@ -41,6 +41,10 @@ Scene::Scene(const QRectF &rect)
|
|||
}, _lifetime);
|
||||
}
|
||||
|
||||
void Scene::cancelDrawing() {
|
||||
_canvas->cancelDrawing();
|
||||
}
|
||||
|
||||
void Scene::addItem(std::shared_ptr<NumberedItem> item) {
|
||||
if (!item) {
|
||||
return;
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<> addsItem() const;
|
||||
|
||||
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
||||
|
||||
void cancelDrawing();
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
|
|
@ -209,6 +209,13 @@ bool ItemCanvas::collidesWithPath(
|
|||
return false;
|
||||
}
|
||||
|
||||
void ItemCanvas::cancelDrawing() {
|
||||
_drawing = false;
|
||||
_contentRect = QRectF();
|
||||
clearPixmap();
|
||||
update();
|
||||
}
|
||||
|
||||
ItemCanvas::~ItemCanvas() {
|
||||
_hq = nullptr;
|
||||
_p = nullptr;
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
|
||||
void applyBrush(const QColor &color, float size);
|
||||
void clearPixmap();
|
||||
void cancelDrawing();
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
void paint(
|
||||
|
|
Loading…
Add table
Reference in a new issue