Compare commits

...

3 Commits

Author SHA1 Message Date
Muyuan Li (from Dev Box)
64bc977047 Address review: case-insensitive FitMode comparison and DPI note
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-14 16:20:46 +08:00
copilot-swe-agent[bot]
a6f3136a56 CmdPal: Fix image overflow in Details panel by defaulting FitColumnWidth to true
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/ddeb4f16-2a6e-49c0-9d10-6f0a85473496

Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
2026-04-29 09:32:38 +00:00
copilot-swe-agent[bot]
7af7e066de Initial plan 2026-04-29 08:50:34 +00:00
2 changed files with 8 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ internal sealed partial class ImageProvider : IImageProvider
return RtbInlineImageFactory.Create(imageSource.ImageSource, new RtbInlineImageFactory.InlineImageOptions
{
DownscaleOnly = imageSource.Hints.DownscaleOnly ?? true,
FitColumnWidth = imageSource.Hints.FitMode == "fit",
FitColumnWidth = imageSource.Hints.FitMode is null || imageSource.Hints.FitMode.Equals("fit", StringComparison.OrdinalIgnoreCase),
MaxWidthDip = imageSource.Hints.MaxPixelWidth,
MaxHeightDip = imageSource.Hints.MaxPixelHeight,
WidthDip = imageSource.Hints.DesiredPixelWidth,

View File

@@ -154,8 +154,8 @@ internal sealed partial class SampleMarkdownImagesPage : ContentPage
For URIs that support query parameters (file, http, ms-appx, ms-appdata), you can provide hints to control scaling
- `--x-cmdpal-fit`
- `none`: no automatic scaling, provides image as is (default)
- `fit`: scale to fit the available space
- `fit`: scale to fit the available space (default)
- `none`: no automatic scaling, provides image as is
- `--x-cmdpal-upscale`
- `true`: allow upscaling
- `false`: downscale only (default)
@@ -169,18 +169,19 @@ internal sealed partial class SampleMarkdownImagesPage : ContentPage
## Examples
### No scaling
This sample uses the source pixel size, so under non-100% DPI scaling the rendered size can differ from the image's natural visual size.
```xml
![green rectangle]({{path1}})
![green rectangle]({{path1}}?--x-cmdpal-fit=none)
```
![green rectangle]({{path1}})
![green rectangle]({{path1}}?--x-cmdpal-fit=none)
### Scale to fit (scaling down only by default)
```xml
![green rectangle]({{path1}}?--x-cmdpal-fit=fit)
![green rectangle]({{path1}})
```
![green rectangle]({{path1}}?--x-cmdpal-fit=fit)
![green rectangle]({{path1}})
### Scale to fit (in both direction)
```xml