Hi, @Hui Liu-MSFT .
I've solved the problem.
We modified the way Scale is calculated, so it works fine in any case.
I share the code I used.
public void SetFullPageStrokes(StrokeCollection[] strokes, double originalWidth, double originalHeight, double currentWidth, double currentHeight)
{
if (strokes == null)
return;
double scaleX = currentWidth / originalWidth;
double scaleY = currentHeight / originalHeight;
double scale = originalWidth > currentWidth ? Math.Max(scaleX, scaleY) : Math.Min(scaleX, scaleY);
double displayedImageWidth = originalWidth * scale;
double displayedImageHeight = originalHeight * scale;
double offsetX = (currentWidth - displayedImageWidth) / 2;
double offsetY = (currentHeight - displayedImageHeight) / 2;
var matrix = Matrix.Identity;
matrix.Scale(scale, scale);
matrix.Translate(offsetX, offsetY);
foreach (var loadedStrokes in strokes)
{
if (loadedStrokes != null)
{
foreach (Stroke stroke in loadedStrokes)
{
stroke.Transform(matrix, false);
}
}
}
PageStrokes = strokes;
}