render: sub-canvases inherit the root layout viewport for fluid resolution
Content drawn inside a scroll rendered smaller than identical content outside it: the scroll viewport draws its child into a sub-canvas sized to the viewport rect, and Canvas::viewport_layout / viewport_logical — the viewports that geom_px and font_px resolve fluid Lengths against — returned the canvas's own size. Inside a 312 px sub-canvas on a 360 px surface every fluid geometry (icon sizes, row heights, paddings) and font size resolved against 312 instead of 360, shrinking the scroll content by the width ratio, ~13 % in a phone-sized window with 24 px margins. First observed in Eydos Settings' Wi-Fi list, where the connected network row sits outside the scroll and the rest inside: the same full-fan signal icon measured 21x18 px outside and 18x16 px inside. Add a layout_viewport field to SoftwareCanvas and GlesCanvas, None on root canvases and set by sub_canvas to the parent's effective layout viewport, so nested sub-canvases keep propagating the root surface size. viewport_layout and viewport_logical consult the inherited value before falling back to the canvas size. Root canvases are untouched, and the GLES clip layers, which reuse sub_canvas, get the same correction.
This commit is contained in:
@@ -336,6 +336,7 @@ impl GlesCanvas
|
||||
font_face,
|
||||
font_registry: None,
|
||||
dpi_scale: 1.0,
|
||||
layout_viewport: None,
|
||||
global_alpha: 1.0,
|
||||
width,
|
||||
height,
|
||||
@@ -547,6 +548,8 @@ impl GlesCanvas
|
||||
font_face: self.font_face,
|
||||
font_registry: self.font_registry.as_ref().map( Arc::clone ),
|
||||
dpi_scale: self.dpi_scale,
|
||||
layout_viewport: Some( self.layout_viewport.unwrap_or(
|
||||
( self.width as f32, self.height as f32 ) ) ),
|
||||
global_alpha: self.global_alpha,
|
||||
width,
|
||||
height,
|
||||
|
||||
Reference in New Issue
Block a user