Fractional GUI scale (0.5 step), fit menu to window, fix settings pages

- display.gui-scale is now a number: 0 (auto) or 0.5..4 in 0.5 steps
- explicit scale is no longer limited by window size (tiled windows);
  only an open menu page is shrunk to fit the window
- snap Batch2D vertices to pixels on fractional scale (fixes dots above text)
- pass app to settings_common via options (not visible inside modules)
- gui.get_scale() returns a number
This commit is contained in:
loki5512344 2026-10-03 15:28:03 +02:00
parent 33e132a231
commit 48d5d54b77
13 changed files with 76 additions and 41 deletions

View file

@ -3,6 +3,7 @@
-- Usage in a page script:
--
-- local settings = require "core:settings_common".new(document, {
-- app = app,
-- tostring_overrides = {["display.framerate"] = function(x) ... end}
-- })
-- -- templates call these functions by name, so they must be global
@ -15,9 +16,11 @@ local settings_common = {}
--- Create helpers bound to the page document.
--- @param document the page document
--- @param options table (optional) with fields:
--- app: the page's `app` library (not visible inside modules)
--- tostring_overrides: {[setting_id] = function(value) -> string}
function settings_common.new(document, options)
options = options or {}
local app = options.app
local tostring_overrides = options.tostring_overrides or {}
local this = {}