fix(cursor): align painted and native minimum sizes

This commit is contained in:
fufesou
2026-09-12 20:01:26 +08:00
parent 6934b3cb14
commit 8dfff101f8
2 changed files with 49 additions and 7 deletions

View File

@@ -1423,10 +1423,14 @@ class CursorPaint extends StatelessWidget {
}
final image = m.image ?? preDefaultCursor.image;
final nativePixels = isWindows ? MediaQuery.devicePixelRatioOf(context) : 1.0;
// Match native registration's logical minimum for density-aware scaled views.
final logicalMinimum = (m.cache?.pixelRatio ?? 0) > 0 &&
c.viewStyle.style != kRemoteViewStyleOriginal;
final nativePixels = isWindows && !logicalMinimum
? MediaQuery.devicePixelRatioOf(context) : 1.0;
// Show remote cursor follows the image scale, independently of Zoom cursor.
double scale = _cursorImageScale(c.parent.target!, m);
if (image != null && scale * nativePixels != 1.0) {
if (image != null && (logicalMinimum || scale * nativePixels != 1.0)) {
final sx = kMinCursorSize / (image.width * nativePixels);
final sy = kMinCursorSize / (image.height * nativePixels);
// Preserve Original's short-edge minimum; scaled views use the long edge.