- Code: Select all
void KisCefClient::OnLoadingStateChange (CefRefPtr<CefBrowser> browser, bool isLoading, bool canGoBack,
bool canGoForward)
{
CEF_REQUIRE_UI_THREAD();
if (browser->IsSame (m_browser))
{
CefRefPtr<CefBrowserHost> host = m_browser->GetHost();
host->SetZoomLevel (0); // 100%
}
}
This works but is not a very nice solution, because the page renders in a different zoom while loading and then changes to 100% when loading finished. Apparently SetZoomLevel does not do anything when loading starts (i.e. when isLoading is true).
Is it possible to do this better so the user does not notice the zoom level is being changed?