fix cursor (hotx,hoty) && add default remote cursor image

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-11-13 23:41:07 +08:00
parent 5a25d0c9f7
commit a3afb03109
3 changed files with 83 additions and 58 deletions

View File

@@ -862,11 +862,19 @@ class CursorPaint extends StatelessWidget {
final c = Provider.of<CanvasModel>(context);
final adjust = gFFI.cursorModel.adjustForKeyboard();
var s = c.scale;
double hotx = m.hotx;
double hoty = m.hoty;
if (m.image == null) {
if (m.defaultCache != null) {
hotx = m.defaultCache!.hotx;
hoty = m.defaultCache!.hoty;
}
}
return CustomPaint(
painter: ImagePainter(
image: m.image,
x: m.x * s - m.hotx + c.x,
y: m.y * s - m.hoty + c.y - adjust,
image: m.image ?? m.defaultImage,
x: m.x * s - hotx + c.x,
y: m.y * s - hoty + c.y - adjust,
scale: 1),
);
}