mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-03-03 21:30:16 +00:00
!2215 【Bugfix】修复sensor场景下Orientation切换现场还原问题
Merge pull request !2215 from X PN/bugfix-orientation
This commit is contained in:
commit
e2c847682f
@ -55,10 +55,18 @@ bool ScreenRotationController::IsScreenRotationLocked()
|
||||
|
||||
void ScreenRotationController::SetScreenRotationLocked(bool isLocked)
|
||||
{
|
||||
isScreenRotationLocked_ = isLocked;
|
||||
if (isLocked) {
|
||||
rotationLockedRotation_ = GetCurrentDisplayRotation();
|
||||
return;
|
||||
}
|
||||
if (GetCurrentDisplayRotation() == ConvertDeviceToDisplayRotation(lastSensorRotationConverted_)) {
|
||||
return;
|
||||
}
|
||||
Orientation currentOrientation = GetPreferredOrientation();
|
||||
if (IsSensorRelatedOrientation(currentOrientation)) {
|
||||
ProcessSwitchToSensorRelatedOrientation(currentOrientation, lastSensorRotationConverted_);
|
||||
}
|
||||
isScreenRotationLocked_ = isLocked;
|
||||
}
|
||||
|
||||
void ScreenRotationController::SetDefaultDeviceRotationOffset(uint32_t defaultDeviceRotationOffset)
|
||||
@ -257,16 +265,14 @@ void ScreenRotationController::ProcessSwitchToSensorRelatedOrientation(
|
||||
void ScreenRotationController::ProcessSwitchToAutoRotation(DeviceRotation rotation)
|
||||
{
|
||||
if (rotation != DeviceRotation::INVALID) {
|
||||
return;
|
||||
SetScreenRotation(ConvertDeviceToDisplayRotation(rotation));
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenRotationController::ProcessSwitchToAutoRotationPortrait(DeviceRotation rotation)
|
||||
{
|
||||
if (IsCurrentDisplayVertical()) {
|
||||
return;
|
||||
}
|
||||
if (IsDeviceRotationVertical(rotation)) {
|
||||
SetScreenRotation(ConvertDeviceToDisplayRotation(rotation));
|
||||
return;
|
||||
}
|
||||
SetScreenRotation(ConvertDeviceToDisplayRotation(DeviceRotation::ROTATION_PORTRAIT));
|
||||
@ -274,10 +280,8 @@ void ScreenRotationController::ProcessSwitchToAutoRotationPortrait(DeviceRotatio
|
||||
|
||||
void ScreenRotationController::ProcessSwitchToAutoRotationLandscape(DeviceRotation rotation)
|
||||
{
|
||||
if (IsCurrentDisplayHorizontal()) {
|
||||
return;
|
||||
}
|
||||
if (IsDeviceRotationHorizontal(rotation)) {
|
||||
SetScreenRotation(ConvertDeviceToDisplayRotation(rotation));
|
||||
return;
|
||||
}
|
||||
SetScreenRotation(ConvertDeviceToDisplayRotation(DeviceRotation::ROTATION_LANDSCAPE));
|
||||
|
Loading…
x
Reference in New Issue
Block a user