diff options
author | Hüseyin ASLITÜRK <asliturk@hotmail.com> | 2020-06-15 11:17:56 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-16 14:42:18 +0200 |
commit | ea1ebe866299ef75376dc79c9406faa35c431d24 (patch) | |
tree | 082557ece3d523d5d5668993623d8ba53bd1fdbe /Applications/QuickShow | |
parent | bf3d98012ab9641c5935fda6aca0e176ac0e92c6 (diff) | |
download | serenity-ea1ebe866299ef75376dc79c9406faa35c431d24.zip |
QuickShow: Add reset zoom action to toolbar
When zoom reset also reset pan origin
Diffstat (limited to 'Applications/QuickShow')
-rw-r--r-- | Applications/QuickShow/QSWidget.cpp | 3 | ||||
-rw-r--r-- | Applications/QuickShow/main.cpp | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Applications/QuickShow/QSWidget.cpp b/Applications/QuickShow/QSWidget.cpp index 06cdb91ea5..6732c90085 100644 --- a/Applications/QuickShow/QSWidget.cpp +++ b/Applications/QuickShow/QSWidget.cpp @@ -127,6 +127,9 @@ void QSWidget::set_scale(int scale) if (scale > 1000) scale = 1000; + if (scale == 100) + m_pan_origin = { 0, 0 }; + m_scale = scale; relayout(); } diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index 7430cbfa8b..2146b92c4a 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -204,7 +204,7 @@ int main(int argc, char** argv) widget.set_scale(widget.scale() + 10); }); - auto zoom_reset_action = GUI::Action::create("Zoom 100%", { Mod_None, Key_0 }, + auto zoom_reset_action = GUI::Action::create("Zoom 100%", { Mod_None, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"), [&](auto&) { widget.set_scale(100); }); @@ -233,6 +233,7 @@ int main(int argc, char** argv) main_toolbar.add_action(go_last_action); main_toolbar.add_separator(); main_toolbar.add_action(zoom_in_action); + main_toolbar.add_action(zoom_reset_action); main_toolbar.add_action(zoom_out_action); auto menubar = GUI::MenuBar::construct(); |