Preserve thin cursor proportions at the visibility minimum

This commit is contained in:
fufesou
2026-09-14 13:54:04 +08:00
parent 70e345a76d
commit f487aaed99
6 changed files with 51 additions and 38 deletions

View File

@@ -2915,19 +2915,11 @@ class CursorData {
debugPrint('Rejected cursor $id: invalid scale $scale');
return null;
}
if (!useLegacyMinimum) {
// Preserve unscaled legacy artwork, but never enlarge a thin cursor just
// to make its short edge reach the visibility minimum.
if (!useLegacyMinimum || scale != 1.0) {
scale = max(scale, kMinCursorSize / max(width, height));
}
if (useLegacyMinimum && scale != 1.0) {
// Update data if scale changed.
final tgtWidth = width * scale;
final tgtHeight = height * scale;
if (tgtWidth < kMinCursorSize || tgtHeight < kMinCursorSize) {
double sw = kMinCursorSize.toDouble() / width;
double sh = kMinCursorSize.toDouble() / height;
scale = sw < sh ? sh : sw;
}
}
if (!_validCursorRasterSize(width * scale, height * scale,
rasterScale: rasterScale)) {