mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Allow zooming in WebView
Note that this does not force-enable zooming on pages with set viewports (which typically implies proper mobile scaling). Closes #8588
This commit is contained in:
		@@ -4,6 +4,7 @@ import android.content.pm.ApplicationInfo
 | 
			
		||||
import android.webkit.WebResourceRequest
 | 
			
		||||
import android.webkit.WebView
 | 
			
		||||
import androidx.compose.foundation.layout.Box
 | 
			
		||||
import androidx.compose.foundation.layout.fillMaxSize
 | 
			
		||||
import androidx.compose.foundation.layout.fillMaxWidth
 | 
			
		||||
import androidx.compose.foundation.layout.padding
 | 
			
		||||
import androidx.compose.material.icons.Icons
 | 
			
		||||
@@ -125,7 +126,9 @@ fun WebViewScreen(
 | 
			
		||||
 | 
			
		||||
        WebView(
 | 
			
		||||
            state = state,
 | 
			
		||||
            modifier = Modifier.padding(contentPadding),
 | 
			
		||||
            modifier = Modifier
 | 
			
		||||
                .padding(contentPadding)
 | 
			
		||||
                .fillMaxSize(),
 | 
			
		||||
            navigator = navigator,
 | 
			
		||||
            onCreated = { webView ->
 | 
			
		||||
                webView.setDefaultSettings()
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,11 @@ fun WebView.setDefaultSettings() {
 | 
			
		||||
        useWideViewPort = true
 | 
			
		||||
        loadWithOverviewMode = true
 | 
			
		||||
        cacheMode = WebSettings.LOAD_DEFAULT
 | 
			
		||||
 | 
			
		||||
        // Allow zooming
 | 
			
		||||
        setSupportZoom(true)
 | 
			
		||||
        builtInZoomControls = true
 | 
			
		||||
        displayZoomControls = false
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user