mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed ability to draw blank lines in photo editor.
This commit is contained in:
parent
a631a28092
commit
a91efd9164
4 changed files with 13 additions and 23 deletions
|
@ -66,11 +66,6 @@ Paint::Paint(
|
|||
_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
_view->setStyleSheet(kViewStyle.utf8());
|
||||
|
||||
_scene->addsItem(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateUndoState();
|
||||
}, lifetime());
|
||||
|
||||
// Undo / Redo.
|
||||
controllers->undoController->performRequestChanges(
|
||||
) | rpl::start_with_next([=](const Undo &command) {
|
||||
|
@ -138,10 +133,10 @@ Paint::Paint(
|
|||
? controllers->stickersPanelController->stickerChosen(
|
||||
) | rpl::to_empty
|
||||
: rpl::never<>(),
|
||||
_scene->mousePresses()
|
||||
_scene->addsItem()
|
||||
) | rpl::start_with_next([=] {
|
||||
_hasUndo = true;
|
||||
clearRedoList();
|
||||
updateUndoState();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
|||
return;
|
||||
}
|
||||
_canvas->handleMousePressEvent(event);
|
||||
_mousePresses.fire({});
|
||||
}
|
||||
|
||||
void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||
|
@ -94,10 +93,6 @@ void Scene::applyBrush(const QColor &color, float size) {
|
|||
_canvas->applyBrush(color, size);
|
||||
}
|
||||
|
||||
rpl::producer<> Scene::mousePresses() const {
|
||||
return _mousePresses.events();
|
||||
}
|
||||
|
||||
rpl::producer<> Scene::addsItem() const {
|
||||
return _addsItem.events();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
void removeItem(not_null<QGraphicsItem*> item);
|
||||
void removeItem(const ItemPtr &item);
|
||||
[[nodiscard]] rpl::producer<> addsItem() const;
|
||||
[[nodiscard]] rpl::producer<> mousePresses() const;
|
||||
|
||||
[[nodiscard]] std::vector<MTPInputDocument> attachedStickers() const;
|
||||
protected:
|
||||
|
@ -51,7 +50,6 @@ private:
|
|||
float64 _lastLineZ = 0.;
|
||||
int _itemNumber = 0;
|
||||
|
||||
rpl::event_stream<> _mousePresses;
|
||||
rpl::event_stream<> _addsItem;
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
|
|
|
@ -168,16 +168,18 @@ void ItemCanvas::handleMouseReleaseEvent(
|
|||
}
|
||||
_drawing = false;
|
||||
|
||||
const auto scaledContentRect = QRectF(
|
||||
_contentRect.x() * cRetinaFactor(),
|
||||
_contentRect.y() * cRetinaFactor(),
|
||||
_contentRect.width() * cRetinaFactor(),
|
||||
_contentRect.height() * cRetinaFactor());
|
||||
if (_contentRect.isValid()) {
|
||||
const auto scaledContentRect = QRectF(
|
||||
_contentRect.x() * cRetinaFactor(),
|
||||
_contentRect.y() * cRetinaFactor(),
|
||||
_contentRect.width() * cRetinaFactor(),
|
||||
_contentRect.height() * cRetinaFactor());
|
||||
|
||||
_grabContentRequests.fire({
|
||||
.pixmap = _pixmap.copy(scaledContentRect.toRect()),
|
||||
.position = _contentRect.topLeft(),
|
||||
});
|
||||
_grabContentRequests.fire({
|
||||
.pixmap = _pixmap.copy(scaledContentRect.toRect()),
|
||||
.position = _contentRect.topLeft(),
|
||||
});
|
||||
}
|
||||
clearPixmap();
|
||||
update();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue