fix(web): align cursor bitmap and hotspot rounding

This commit is contained in:
fufesou
2026-09-12 00:20:28 +08:00
parent a7f1eb4c25
commit 5f4bb00007
3 changed files with 69 additions and 5 deletions

View File

@@ -52,8 +52,8 @@ class CursorManager {
'cursor',
jsonEncode({
'url': cursorData.url,
'hotx': cursorData.hotX.toInt(),
'hoty': cursorData.hotY.toInt(),
'hotx': cursorData.hotX.round(),
'hoty': cursorData.hotY.round(),
})
]);
}
@@ -116,8 +116,8 @@ MouseCursor buildCursorOfCache(
CursorManager.instance.registerCursor(CursorData(
key: key,
url: 'data:image/rgba;base64,${base64Encode(data)}',
width: (cache.width * cache.scale).toInt(),
height: (cache.height * cache.scale).toInt(),
width: cache.scaledWidth,
height: cache.scaledHeight,
hotX: cache.hotx,
hotY: cache.hoty));
cursor.addKey(key);