cursor pos linux
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
a3afb03109
commit
60a30042c0
@ -490,8 +490,8 @@ class CursorPaint extends StatelessWidget {
|
||||
double hoty = m.hoty;
|
||||
if (m.image == null) {
|
||||
if (m.defaultCache != null) {
|
||||
hotx = m.defaultCache!.hotx;
|
||||
hoty = m.defaultCache!.hoty;
|
||||
hotx = m.defaultImage!.width / 2;
|
||||
hoty = m.defaultImage!.height / 2;
|
||||
}
|
||||
}
|
||||
return CustomPaint(
|
||||
|
@ -866,15 +866,15 @@ class CursorPaint extends StatelessWidget {
|
||||
double hoty = m.hoty;
|
||||
if (m.image == null) {
|
||||
if (m.defaultCache != null) {
|
||||
hotx = m.defaultCache!.hotx;
|
||||
hoty = m.defaultCache!.hoty;
|
||||
hotx = m.defaultImage!.width / 2;
|
||||
hoty = m.defaultImage!.height / 2;
|
||||
}
|
||||
}
|
||||
return CustomPaint(
|
||||
painter: ImagePainter(
|
||||
image: m.image ?? m.defaultImage,
|
||||
x: m.x * s - hotx + c.x,
|
||||
y: m.y * s - hoty + c.y - adjust,
|
||||
x: m.x * s - hotx * s + c.x,
|
||||
y: m.y * s - hoty * s + c.y - adjust,
|
||||
scale: 1),
|
||||
);
|
||||
}
|
||||
|
@ -721,14 +721,14 @@ class CursorData {
|
||||
height: (height * scale).toInt(),
|
||||
)
|
||||
.getBytes(format: img2.Format.bgra);
|
||||
if (hotx > 0 && hoty > 0) {
|
||||
// default cursor data
|
||||
hotx = (width * scale) / 2;
|
||||
hoty = (height * scale) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.scale = scale;
|
||||
if (hotx > 0 && hoty > 0) {
|
||||
// default cursor data
|
||||
hotx = (width * scale) / 2;
|
||||
hoty = (height * scale) / 2;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
@ -798,20 +798,23 @@ class CursorModel with ChangeNotifier {
|
||||
CursorData? _getDefaultCache() {
|
||||
if (_defaultCache == null) {
|
||||
Uint8List data;
|
||||
double scale = 1.0;
|
||||
double hotx = (defaultCursorImage!.width * scale) / 2;
|
||||
double hoty = (defaultCursorImage!.height * scale) / 2;
|
||||
if (Platform.isWindows) {
|
||||
data = defaultCursorImage!.getBytes(format: img2.Format.bgra);
|
||||
} else {
|
||||
data = Uint8List.fromList(img2.encodePng(defaultCursorImage!));
|
||||
}
|
||||
double scale = 1.0;
|
||||
|
||||
_defaultCache = CursorData(
|
||||
peerId: id,
|
||||
id: _defaultCacheId,
|
||||
image: defaultCursorImage?.clone(),
|
||||
scale: scale,
|
||||
data: data,
|
||||
hotx: (defaultCursorImage!.width * scale) / 2,
|
||||
hoty: (defaultCursorImage!.height * scale) / 2,
|
||||
hotx: hotx,
|
||||
hoty: hoty,
|
||||
width: defaultCursorImage!.width,
|
||||
height: defaultCursorImage!.height,
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user