From 35d14a44fc96093829a9f5938f18cad010976814 Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 16 Jun 2023 12:48:25 +0800 Subject: [PATCH] remove fit local resolution if the remote resolutions do not contain the local resolution Signed-off-by: fufesou --- flutter/lib/desktop/widgets/remote_toolbar.dart | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index 371a1d7e7..bcbd39559 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -1218,21 +1218,13 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { return _localResolution!; } - squareDistance(Resolution lhs, Resolution rhs) => - (lhs.width - rhs.width) * (lhs.width - rhs.width) + - (lhs.height - rhs.height) * (lhs.height - rhs.height); - - Resolution res = Resolution(display.width, display.height); for (final r in resolutions) { - if (r.width <= _localResolution!.width && - r.height <= _localResolution!.height) { - if (squareDistance(r, _localResolution!) < - squareDistance(res, _localResolution!)) { - res = r; - } + if (r.width == _localResolution!.width && r.height == _localResolution!.height) { + return r; } } - return res; + + return null; } bool _isRemoteResolutionFitLocal() {