webclient: fix browser scaling and zoom
- Add [display] section to project.godot:
- 1280x720 base viewport (was unset → Godot default tiny resolution)
- stretch/mode = canvas_items: all UI + text scales proportionally
- stretch/aspect = expand: fills window, adds space on wider screens
- Add html/head_include script that runs on page load:
- Sets canvas touch-action to 'auto' (removes Godot's default 'none'
which blocked pinch-to-zoom on mobile)
- Patches viewport meta to allow user-scalable=yes, maximum-scale=5.0
so browser zoom works on both desktop and mobile
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -28,7 +28,7 @@ vram_texture_compression/for_desktop=true
|
|||||||
vram_texture_compression/for_mobile=true
|
vram_texture_compression/for_mobile=true
|
||||||
html/export_icon=true
|
html/export_icon=true
|
||||||
html/custom_html_shell=""
|
html/custom_html_shell=""
|
||||||
html/head_include=""
|
html/head_include="<script>window.addEventListener('load',function(){var c=document.querySelector('canvas');if(c){c.style.touchAction='auto';}var m=document.querySelector('meta[name=viewport]');if(m){m.setAttribute('content','width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0');}else{var t=document.createElement('meta');t.name='viewport';t.content='width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0';document.head.appendChild(t);}});</script>"
|
||||||
html/canvas_resize_policy=2
|
html/canvas_resize_policy=2
|
||||||
html/focus_canvas_on_start=true
|
html/focus_canvas_on_start=true
|
||||||
html/experimental_virtual_keyboard=true
|
html/experimental_virtual_keyboard=true
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ Auth="*res://autoloads/Auth.gd"
|
|||||||
|
|
||||||
pointing/emulate_touch_from_mouse=true
|
pointing/emulate_touch_from_mouse=true
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=1280
|
||||||
|
window/size/viewport_height=720
|
||||||
|
window/stretch/mode="canvas_items"
|
||||||
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
|||||||
Reference in New Issue
Block a user