Created
April 26, 2019 04:01
-
-
Save leptos-null/9979acc91cd9fd99aee878f5afbffcaa to your computer and use it in GitHub Desktop.
An idea for maintaining orientation state through notify_state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
union UIOrientationPortableState { | |
struct UIOrientationState { | |
enum UIOrientation { /* this is UIInterfaceOrientation, but unsigned */ | |
UIOrientationUnknown, | |
UIOrientationPortrait, | |
UIOrientationPortraitUpsideDown, | |
UIOrientationLandscapeRight, | |
UIOrientationLandscapeLeft | |
} | |
current : 3, // may be the orientation the device is transitioning to, if transition != UITransitionPhaseZero | |
previous : 3; // may be unknown when transition == UITransitionPhaseZero | |
enum UIAnimationCurve { /* this is UIViewAnimationCurve, but unsigned */ | |
UIAnimationCurveEaseInOut, | |
UIAnimationCurveEaseIn, | |
UIAnimationCurveEaseOut, | |
UIAnimationCurveLinear | |
} curve : 2; // describes the calculation used for the transition between current and previous | |
enum UITransitionPhase { | |
UITransitionPhaseZero, // transition is not is progress | |
/* transition in progress */ | |
UITransitionPhaseDone = ((1 << 24) - 1) | |
} transition : 24; // use floating division with UITransitionPhaseDone to get the percent into the transition | |
float duration; // total duration of the transition in seconds | |
} state; | |
uint64_t hash; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment