Merge pull request #4658 from fufesou/refact/remove_confusing_fit_local_resolution

hide "Fit local resolution" if the remote resolutions do not contain the local resolution
This commit is contained in:
RustDesk 2023-06-16 13:29:04 +08:00 committed by GitHub
commit a1e8e53ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1218,21 +1218,13 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
return _localResolution!; 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) { for (final r in resolutions) {
if (r.width <= _localResolution!.width && if (r.width == _localResolution!.width && r.height == _localResolution!.height) {
r.height <= _localResolution!.height) { return r;
if (squareDistance(r, _localResolution!) <
squareDistance(res, _localResolution!)) {
res = r;
} }
} }
}
return res; return null;
} }
bool _isRemoteResolutionFitLocal() { bool _isRemoteResolutionFitLocal() {