diff --git a/Telegram/SourceFiles/core/core_settings.cpp b/Telegram/SourceFiles/core/core_settings.cpp index c0293b01a..d3f090230 100644 --- a/Telegram/SourceFiles/core/core_settings.cpp +++ b/Telegram/SourceFiles/core/core_settings.cpp @@ -1583,8 +1583,13 @@ rpl::producer Settings::ivZoomValue() const { return _ivZoom.value(); } void Settings::setIvZoom(int value) { +#ifdef Q_OS_WIN + constexpr auto kMin = 25; + constexpr auto kMax = 500; +#else constexpr auto kMin = 30; constexpr auto kMax = 200; +#endif _ivZoom = std::clamp(value, kMin, kMax); } diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp index 62348a986..01e955674 100644 --- a/Telegram/SourceFiles/iv/iv_controller.cpp +++ b/Telegram/SourceFiles/iv/iv_controller.cpp @@ -369,10 +369,16 @@ Controller::Controller( Fn showShareBox) : _delegate(delegate) , _updateStyles([=] { - const auto zoom = _delegate->ivZoom(); - const auto str = Ui::EscapeForScriptString(ComputeStyles(zoom)); if (_webview) { + const auto webviewZoomController = _webview->zoomController(); + const auto styleZoom = webviewZoomController + ? kDefaultZoom + : _delegate->ivZoom(); + const auto str = Ui::EscapeForScriptString(ComputeStyles(styleZoom)); _webview->eval("IV.updateStyles('" + str + "');"); + if (webviewZoomController) { + webviewZoomController->setZoom(_delegate->ivZoom()); + } } }) , _showShareBox(std::move(showShareBox)) { @@ -634,6 +640,17 @@ void Controller::createWebview(const Webview::StorageId &storageId) { }); const auto raw = _webview.get(); + if (const auto webviewZoomController = raw->zoomController()) { + webviewZoomController->zoomValue( + ) | rpl::start_with_next([this](int value) { + _delegate->ivSetZoom(value); + }, lifetime()); + _delegate->ivZoomValue( + ) | rpl::start_with_next([=, this](int value) { + webviewZoomController->setZoom(value); + }, lifetime()); + } + window->lifetime().add([=] { _ready = false; base::take(_webview); @@ -785,8 +802,12 @@ void Controller::createWebview(const Webview::StorageId &storageId) { || index >= _pages.size()) { return Webview::DataResult::Failed; } + const auto webviewZoomController = _webview->zoomController(); + const auto styleZoom = webviewZoomController + ? kDefaultZoom + : _delegate->ivZoom(); return finishWith( - WrapPage(_pages[index], _delegate->ivZoom()), + WrapPage(_pages[index], styleZoom), "text/html; charset=utf-8"); } else if (id.starts_with("page") && id.ends_with(".json")) { auto index = 0; diff --git a/Telegram/lib_webview b/Telegram/lib_webview index e9e85a10e..d5337d58e 160000 --- a/Telegram/lib_webview +++ b/Telegram/lib_webview @@ -1 +1 @@ -Subproject commit e9e85a10e6864e18ffd540df04d7965d0af39500 +Subproject commit d5337d58ebe39cffe421c7ce7725d2bfe9d03159