Skip to content

Commit fb3aee6

Browse files
committed
fix: web content size inside mac and ios webview
1 parent e8551b7 commit fb3aee6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Packages/Passport/Runtime/Scripts/Private/UI/WebViews/MacOSPassportWebView.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
8383
// Create WebView prefab and parent to Canvas
8484
_webViewPrefab = CanvasWebViewPrefab.Instantiate();
8585
PassportLogger.Info($"{TAG} CanvasWebViewPrefab created successfully");
86-
_webViewPrefab.Native2DModeEnabled = false; // Use standard mode for better desktop compatibility
86+
_webViewPrefab.Native2DModeEnabled = true; // Use Native2DMode for better performance on desktop
8787

88-
// Set higher resolution for desktop - MacOS can handle larger textures
89-
_webViewPrefab.Resolution = 1.5f; // 1.5px per Unity unit for crisp rendering
88+
// Set lower resolution for faster loading and rendering
89+
_webViewPrefab.Resolution = 0.75f; // Balanced resolution for desktop
9090

9191
// Must be child of Canvas for Vuplex to work
9292
_webViewPrefab.transform.SetParent(_canvasReference.canvas.transform, false);
@@ -96,9 +96,9 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
9696
rect.anchorMin = new Vector2(0.5f, 0.5f); // Center anchor
9797
rect.anchorMax = new Vector2(0.5f, 0.5f);
9898

99-
// Use configured dimensions or fallback to desktop-appropriate defaults
100-
float width = config.Width > 0 ? config.Width : 1200;
101-
float height = config.Height > 0 ? config.Height : 800;
99+
// Use configured dimensions or fallback to desktop-appropriate defaults (optimized for performance)
100+
float width = config.Width > 0 ? config.Width : 600;
101+
float height = config.Height > 0 ? config.Height : 650;
102102
rect.sizeDelta = new Vector2(width, height);
103103
rect.anchoredPosition = Vector2.zero; // Center position
104104

src/Packages/Passport/Runtime/Scripts/Private/UI/WebViews/iOSPassportWebView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
8282
_webViewPrefab = CanvasWebViewPrefab.Instantiate();
8383
_webViewPrefab.Native2DModeEnabled = false; // Disable Native2DMode to avoid Unity integration issues
8484

85-
// Set reasonable resolution - much lower to avoid texture size issues
86-
_webViewPrefab.Resolution = 1.0f; // 1px per Unity unit - creates 800x600px texture
85+
// Set higher resolution for better content scaling on mobile
86+
_webViewPrefab.Resolution = 0.5f; // increase to scale down content, decrease to scale up content
8787

8888
// Must be child of Canvas for Vuplex to work
8989
_webViewPrefab.transform.SetParent(_canvasReference.canvas.transform, false);
@@ -93,9 +93,9 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
9393
rect.anchorMin = new Vector2(0.5f, 0.5f); // Center anchor
9494
rect.anchorMax = new Vector2(0.5f, 0.5f);
9595

96-
// Use configured dimensions or fallback to reasonable defaults
96+
// Use configured dimensions or fallback to mobile-optimized defaults
9797
float width = config.Width > 0 ? config.Width : 1000;
98-
float height = config.Height > 0 ? config.Height : 700;
98+
float height = config.Height > 0 ? config.Height : 1200;
9999
rect.sizeDelta = new Vector2(width, height);
100100
rect.anchoredPosition = Vector2.zero; // Center position
101101

0 commit comments

Comments
 (0)