Added condition to zoom in/out only for the current tab

This commit is contained in:
Nikhil Tanwar 2021-09-05 14:51:26 +05:30 committed by Emmanuel Engelhart
parent a95920e391
commit 018da97075
No known key found for this signature in database
GPG Key ID: 120B30D020B553D3

View File

@ -20,6 +20,8 @@ ZimView::ZimView(TabBar *tabBar, QWidget *parent)
auto app = KiwixApp::instance();
connect(app->getAction(KiwixApp::ZoomInAction), &QAction::triggered,
this, [=]() {
if (mp_tabBar->currentZimView() != this)
return;
auto zoomFactor = mp_webView->zoomFactor();
zoomFactor += 0.1;
zoomFactor = max(min(zoomFactor, 5.0), 0.25);
@ -29,6 +31,8 @@ ZimView::ZimView(TabBar *tabBar, QWidget *parent)
});
connect(app->getAction(KiwixApp::ZoomOutAction), &QAction::triggered,
this, [=]() {
if (mp_tabBar->currentZimView() != this)
return;
auto zoomFactor = mp_webView->zoomFactor();
zoomFactor -= 0.1;
zoomFactor = max(min(zoomFactor, 5.0), 0.25);