2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Added initial implementation of mouse drawing in photo editor.

This commit is contained in:
23rd
2021-02-13 07:29:31 +03:00
parent e1ea833ad6
commit 5b6bddd7fc
10 changed files with 254 additions and 13 deletions

View File

@@ -18,11 +18,11 @@ PhotoEditor::PhotoEditor(
std::shared_ptr<QPixmap> photo,
PhotoModifications modifications)
: RpWidget(parent)
, _modifications(modifications)
, _modifications(std::move(modifications))
, _content(base::make_unique_q<PhotoEditorContent>(
this,
photo,
modifications))
_modifications))
, _controls(base::make_unique_q<PhotoEditorControls>(this)) {
sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
@@ -49,10 +49,16 @@ PhotoEditor::PhotoEditor(
_modifications.flipped = !_modifications.flipped;
_content->applyModifications(_modifications);
}, lifetime());
_controls->paintModeRequests(
) | rpl::start_with_next([=] {
_content->applyMode(PhotoEditorMode::Paint);
}, lifetime());
_content->applyMode(PhotoEditorMode::Transform);
}
void PhotoEditor::save() {
_modifications.crop = _content->cropRect();
_content->save(_modifications);
_done.fire_copy(_modifications);
}