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