Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Text-Grab/Utilities/GrabTemplateExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public static class GrabTemplateExecutor
/// </summary>
/// <param name="template">The template to execute.</param>
/// <param name="captureRegion">
/// The screen rectangle (in WPF units, pre-DPI-scaling applied by caller)
/// that bounds the user's selection. Template region ratios are applied to
/// this rectangle's width/height.
/// The screen rectangle in physical screen pixels that bounds the user's
/// selection. Template region ratios are applied to this rectangle's
/// width/height to derive each sub-region's capture bounds.
/// </param>
/// <param name="language">The OCR language to use. Pass null to use the app default.</param>
public static async Task<string> ExecuteTemplateAsync(
Expand Down Expand Up @@ -363,7 +363,7 @@ public static List<string> ValidateOutputTemplate(
}

if (!available.Contains(num))
issues.Add($"Placeholder {{{{num}}}} references region {num} which does not exist.");
issues.Add($"Placeholder {{{num}}} references region {num} which does not exist.");

referenced.Add(num);
}
Expand Down
8 changes: 2 additions & 6 deletions Text-Grab/Views/FullscreenGrab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ private void FullscreenGrab_KeyUp(object sender, KeyEventArgs e)

/// <summary>
/// Draws scaled template region overlays inside the current selection border.
/// Regions are scaled using UniformToFill semantics relative to the template's
/// reference image dimensions so they fill the selected area proportionally.
/// Each region's stored ratio coordinates are applied directly to the current
/// selection dimensions (stretch-to-fill), so both axes scale independently.
/// </summary>
private void UpdateTemplateRegionOverlays(double selLeft, double selTop, double selWidth, double selHeight)
{
Expand All @@ -465,10 +465,6 @@ private void UpdateTemplateRegionOverlays(double selLeft, double selTop, double
if (selWidth < 4 || selHeight < 4)
return;

// Stretch: scale each axis independently to fill the selection exactly
double scaleX = selWidth / template.ReferenceImageWidth;
double scaleY = selHeight / template.ReferenceImageHeight;

templateOverlayCanvas.Width = selWidth;
templateOverlayCanvas.Height = selHeight;
Canvas.SetLeft(templateOverlayCanvas, selLeft);
Expand Down