fix(cursor): align Web hotspots with rounded cursor images

This commit is contained in:
fufesou
2026-09-12 03:29:27 +08:00
parent d876ea0ce4
commit 96cd5cd1e2
3 changed files with 85 additions and 6 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.width * cache.scale).round(),
height: (cache.height * cache.scale).round(),
hotX: cache.hotx,
hotY: cache.hoty));
cursor.addKey(key);