-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Add an option to make device scale factor flexible, in addition to the existing --retina argument #136
Comments
nielthiart
added a commit
to nielthiart/shot-scraper
that referenced
this issue
Dec 18, 2023
This commit adds tests for the `--scale-factor` argument. Ref: simonw#136
simonw
pushed a commit
that referenced
this issue
Feb 5, 2024
* Add a scale factor option Adds the `--scale-factor` option. The `--scale-factor` option allows users to specify a specific device scale factor as a float. This is useful for testing specific high-definition displays. For example, the Google Pixel 6 has a pixel ratio of 2.625. Some modern phones have pixel ratios of 4. The existing `--retina` option is a specific case of the new `--scale-factor` option. The commit also includes a validation to prevent conflicts when using the `--scale-factor` and `--retina` options together. * Add scale factor tests This commit adds tests for the `--scale-factor` argument. Ref: #136
From a successful GitHub Actions run: simonwillison-retina: simonwillison-scale-factor-pixel-six: shot-scraper/tests/run_examples.sh Lines 164 to 169 in b478542
|
simonw
added a commit
that referenced
this issue
Feb 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
--retina
argument is convenient to set a device scale factor of2
, but for my use case I needed a variety of scale factors to match other displays.Ref: #133
For example, Google Pixel 6 has a scale factor of
2.625
. Some devices go up to4
.My proposal is to add an additional argument,
--scale-factor
, that takes a float as argument, and isNone
by default.To avoid confusion when using
--retina
and--scale-factor
simultaneously, we could treat them as mutually exclusive and raise a helpful error. We can also check that the scale factor is positive.A reusable function that validates and normalises the device scale factor provides the opportunity to validate other scale-factor-altering arguments in the future, such as the
--device
argument proposed in #129.The text was updated successfully, but these errors were encountered: