feat(chromium): allow to specify device scale ratio for screenshots (#1543)

This commit is contained in:
Heorhii Ovcharenko
2026-05-04 22:16:04 +03:00
committed by GitHub
parent fe1b0020b8
commit c1cdcbdaab
8 changed files with 43 additions and 23 deletions

View File

@@ -164,11 +164,11 @@ func captureScreenshotActionFunc(logger *slog.Logger, outputPath string, options
}
}
func setDeviceMetricsOverride(logger *slog.Logger, width, height int) chromedp.ActionFunc {
func setDeviceMetricsOverride(logger *slog.Logger, width, height int, deviceScaleFactor float64) chromedp.ActionFunc {
return func(ctx context.Context) error {
logger.DebugContext(ctx, "set device metrics override")
err := emulation.SetDeviceMetricsOverride(int64(width), int64(height), 1.0, false).Do(ctx)
err := emulation.SetDeviceMetricsOverride(int64(width), int64(height), deviceScaleFactor, false).Do(ctx)
if err == nil {
return nil
}