mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-14 07:30:07 -06:00
* DPI scaling 1. Add the ability to query the operating system's DPI scaling values 2. Expose those values through a new Lua function 3. Add an asset that sets the CEF gui and the Dashboard font sizes and placements based on the DPI scaling 4. Add that new asset into the base_blank asset * Add message when including the dpiscaling
38 lines
1.1 KiB
Lua
38 lines
1.1 KiB
Lua
asset.onInitialize(function ()
|
|
local scale = openspace.dpiScaling()
|
|
openspace.printInfo("Setting the DPI scaling factor to " .. tostring(scale))
|
|
|
|
|
|
if openspace.modules.isLoaded("CefWebGui") then
|
|
openspace.setPropertyValueSingle(
|
|
"Modules.CefWebGui.GuiScale",
|
|
openspace.getPropertyValue("Modules.CefWebGui.GuiScale") * scale
|
|
)
|
|
end
|
|
|
|
local dashboards = openspace.getProperty("Dashboard.*.FontSize");
|
|
for _, v in ipairs(dashboards) do
|
|
openspace.setPropertyValueSingle(
|
|
v,
|
|
openspace.getPropertyValue(v) * scale
|
|
)
|
|
end
|
|
|
|
local offset = openspace.getPropertyValue("Dashboard.StartPositionOffset")
|
|
openspace.setPropertyValueSingle(
|
|
"Dashboard.StartPositionOffset",
|
|
{ offset[1] * scale, offset[2] * scale }
|
|
)
|
|
end)
|
|
|
|
asset.meta = {
|
|
Name = "DPI Scaling",
|
|
Version = "1.0",
|
|
Description = [[ Retrieves the DPI scaling from the operating system and applies it to
|
|
a few selected places to make them scale better on "large resolution but small size"
|
|
monitors ]],
|
|
Author = "OpenSpace Team",
|
|
URL = "http://openspaceproject.com",
|
|
License = "MIT license"
|
|
}
|