Did you ever play with 21:9 widescreen? In the servers where I’ve been there is always the annoying issue that all the elements are really far and the user’s stats under the minimap is out of position.
Well, I fixed it for my server and I want to share the resource!
This doesn’t seem intended! UI resources should not be able to touch anything in root.html due to web sandboxing…
… anyway, until that’s fixed, can you please do this without altering root.html, but iterating child frames and adding your stylesheet there? This’ll break if people disconnect from a server.
(also, this won’t support 2560x1080 and 3840x1080 sizes )
Why not just telling all developers who make UI resources to use the correct CSS unit ‘vh’ and ‘vw’ ?
That way nobody needs an other resource to make it fit.
Thank you for your feedback!
I’ll work on that ASAP. Doing what you suggest should not be an issue. The important is to be sure that my resource is started as last and all the other NUI components are loaded… I’ll put a default delay in the execution of the JS code
I can test 2560x1080 on my screen but I don’t reach 3840x1080… I need to check with a 4K screen I have around if I can set it and verify what happens
first of all I have currently no way to test 3840x1080
I believe that the sandbox is (half?) working: I can’t inject my code in root/body/iframe(s) (no error is logged but also no effect from the code execution)
– I can only inject in root/head
I pushed some change to the repo where you can see the code I used to inject in the child iframe(s).
I’m also giving a look to the FiveM’s code. I’m not good in C++ (never studied it unfortunately) but I was wondering if could be a good idea to put a server option (to be enabled in the config) to inject in the root head the media queries that are currently injected by my script and eventually send a PR.
Seems to made things “worse” for me.
I got a 3440x1440. (34" ultrawide - alienware aw3418dw if it matters)
So basically what this did to me is change everything to the size of 1920x1080 (unless that’s what it supposed to, doesn’t look like it on your screenshots, it looks like it actually fixes these issues). Don’t know how to explain it over text but here is a picture:
Hi WhiteTiger,
what you say is, indeed, right. The script is changing the “canvas size” to 2440x1440, on widescreen like ours (I’m on a 34" 3440x1440 too), when the resolution is ‘>=3440’ x 1440 or to 1920x1080 for when the resolution is ‘>=2440’ x 1080
What I see is that your “stats script” (bottom left) already has a margin applied by default and adding my script kind of breaks that margin causing the stats to be too centered.
My suggestion is to take the CSS you can find in this file: https://github.com/PrometheusDevs/pd_max_nui_size/blob/master/html/ui.html
and apply it to the scripts (that use NUI) where you need/want it