mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +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() {
|
void Paint::cancel() {
|
||||||
_scene->clearSelection();
|
_scene->clearSelection();
|
||||||
|
_scene->cancelDrawing();
|
||||||
|
|
||||||
const auto filtered = _scene->items(Qt::AscendingOrder);
|
const auto filtered = _scene->items(Qt::AscendingOrder);
|
||||||
if (filtered.empty()) {
|
if (filtered.empty()) {
|
||||||
|
@ -199,6 +200,7 @@ void Paint::cancel() {
|
||||||
|
|
||||||
void Paint::keepResult() {
|
void Paint::keepResult() {
|
||||||
_scene->clearSelection();
|
_scene->clearSelection();
|
||||||
|
_scene->cancelDrawing();
|
||||||
|
|
||||||
for (const auto &item : _itemsToRemove) {
|
for (const auto &item : _itemsToRemove) {
|
||||||
_scene->removeItem(item);
|
_scene->removeItem(item);
|
||||||
|
|
|
@ -41,6 +41,10 @@ Scene::Scene(const QRectF &rect)
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scene::cancelDrawing() {
|
||||||
|
_canvas->cancelDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
void Scene::addItem(std::shared_ptr<NumberedItem> item) {
|
void Scene::addItem(std::shared_ptr<NumberedItem> item) {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
[[nodiscard]] rpl::producer<> addsItem() const;
|
[[nodiscard]] rpl::producer<> addsItem() const;
|
||||||
|
|
||||||
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
||||||
|
|
||||||
|
void cancelDrawing();
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
|
@ -209,6 +209,13 @@ bool ItemCanvas::collidesWithPath(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ItemCanvas::cancelDrawing() {
|
||||||
|
_drawing = false;
|
||||||
|
_contentRect = QRectF();
|
||||||
|
clearPixmap();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
ItemCanvas::~ItemCanvas() {
|
ItemCanvas::~ItemCanvas() {
|
||||||
_hq = nullptr;
|
_hq = nullptr;
|
||||||
_p = nullptr;
|
_p = nullptr;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
|
|
||||||
void applyBrush(const QColor &color, float size);
|
void applyBrush(const QColor &color, float size);
|
||||||
void clearPixmap();
|
void clearPixmap();
|
||||||
|
void cancelDrawing();
|
||||||
|
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
void paint(
|
void paint(
|
||||||
|
|
Loading…
Add table
Reference in a new issue