-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add DisplayRotationStateTrigger for granular device rotation control #31297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DisplayRotationStateTrigger for granular device rotation control #31297
Conversation
src/Controls/docs/Microsoft.Maui.Controls/DisplayRotationStateTrigger.xml
Outdated
Show resolved
Hide resolved
4eb6936 to
b2740b0
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new DisplayRotationStateTrigger that provides granular control over device rotation states, complementing the existing OrientationStateTrigger which only differentiates between portrait and landscape orientations.
- Adds
DisplayRotationStateTriggerclass for precise rotation detection (0°, 90°, 180°, 270°, Unknown) - Implements comprehensive test coverage with 19 unit tests for all rotation scenarios
- Enhances
MockDeviceDisplaywith rotation testing capabilities
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Controls/src/Core/DisplayRotationStateTrigger.cs |
New state trigger class providing granular rotation-based visual state control |
src/Controls/tests/Core.UnitTests/DisplayRotationStateTriggerTests.cs |
Comprehensive test suite covering all rotation scenarios and edge cases |
src/Controls/tests/Core.UnitTests/OrientationStateTriggerTests.cs |
New test file for existing OrientationStateTrigger functionality |
src/Controls/tests/Core.UnitTests/MockDeviceDisplay.cs |
Enhanced with constructor and SetMainDisplayRotation method for testing |
Multiple PublicAPI.Unshipped.txt files |
API surface additions for the new DisplayRotationStateTrigger across all platforms |
src/Controls/tests/Core.UnitTests/DisplayRotationStateTriggerTests.cs
Outdated
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
This will be nice with the new SafeArea features. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
706d08d to
19ba232
Compare
…ck display improvements Co-authored-by: mattleibow <[email protected]>
…ests Co-authored-by: mattleibow <[email protected]>
Co-authored-by: mattleibow <[email protected]>
…ests.cs Co-authored-by: Copilot <[email protected]>
…rigger Co-authored-by: PureWeen <[email protected]>
69e61d9 to
f026c25
Compare
|
@copilot please update the title and description. Something went wrong and it is all mixed up. Have a look at the code and write a fresh description. It is all out of date now. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Updated the PR title and description to accurately reflect this new feature implementation. The PR introduces DisplayRotationStateTrigger which provides granular control over device rotation states (0°, 90°, 180°, 270°) with comprehensive tests, sample integration, and full documentation. (f026c25) |
Introduces
DisplayRotationStateTrigger, a new state trigger that provides granular control over device display rotation states. UnlikeOrientationStateTriggerwhich only differentiates between portrait and landscape orientations, this trigger responds to specific rotation angles (0°, 90°, 180°, 270°).Overview
This new trigger enables developers to create visual states that are triggered based on the device's exact display rotation, providing more precise control for applications that need to respond differently to specific rotation states.
Key Features
Granular Rotation Control:
Rotation0(0°) - Device in natural positionRotation90(90°) - Device rotated 90 degreesRotation180(180°) - Device upside downRotation270(270°) - Device rotated 270 degreesUnknown- Unknown rotation stateResponsive Design:
DeviceDisplay.MainDisplayInfoChangedDesignMode.IsDesignModeEnabledcheckDeveloper Experience:
Use Cases
Perfect for applications requiring specific rotation-based layouts:
Sample Usage
Implementation Details
OrientationStateTrigger,DeviceStateTrigger)StateTriggersPage.xamldemonstrates practical usage with different background colors for each rotation state✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.