fix: mouse event, is in current window (#12760)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-08-29 01:06:05 +08:00
committed by GitHub
parent d0e9c6dc57
commit a98852e279

View File

@@ -1313,8 +1313,12 @@ class InputModel {
isMove = false; isMove = false;
canvas = coords.canvas; canvas = coords.canvas;
rect = coords.remoteRect; rect = coords.remoteRect;
x -= coords.relativeOffset.dx / devicePixelRatio; x -= isWindows
y -= coords.relativeOffset.dy / devicePixelRatio; ? coords.relativeOffset.dx / devicePixelRatio
: coords.relativeOffset.dx;
y -= isWindows
? coords.relativeOffset.dy / devicePixelRatio
: coords.relativeOffset.dy;
} }
} }
} }
@@ -1339,15 +1343,21 @@ class InputModel {
} }
bool _isInCurrentWindow(double x, double y) { bool _isInCurrentWindow(double x, double y) {
final w = _windowRect!.width / devicePixelRatio; var w = _windowRect!.width;
final h = _windowRect!.width / devicePixelRatio; var h = _windowRect!.height;
if (isWindows) {
w /= devicePixelRatio;
h /= devicePixelRatio;
}
return x >= 0 && y >= 0 && x <= w && y <= h; return x >= 0 && y >= 0 && x <= w && y <= h;
} }
static RemoteWindowCoords? findRemoteCoords(double x, double y, static RemoteWindowCoords? findRemoteCoords(double x, double y,
List<RemoteWindowCoords> remoteWindowCoords, double devicePixelRatio) { List<RemoteWindowCoords> remoteWindowCoords, double devicePixelRatio) {
if (isWindows) {
x *= devicePixelRatio; x *= devicePixelRatio;
y *= devicePixelRatio; y *= devicePixelRatio;
}
for (final c in remoteWindowCoords) { for (final c in remoteWindowCoords) {
if (x >= c.relativeOffset.dx && if (x >= c.relativeOffset.dx &&
y >= c.relativeOffset.dy && y >= c.relativeOffset.dy &&