UI: Fix issues with insta-close pop ups.

Not that these should happen, but at least should make sure they work.
This commit is contained in:
Unknown W. Brackets
2017-03-26 08:58:04 -07:00
parent 0a73828042
commit 755429df81
2 changed files with 10 additions and 8 deletions
+4 -7
View File
@@ -249,16 +249,10 @@ bool PopupScreen::key(const KeyInput &key) {
void PopupScreen::update() {
UIDialogScreen::update();
static const int FRAMES_LEAD_IN = 6;
static const int FRAMES_LEAD_OUT = 4;
float animatePos = 1.0f;
++frames_;
if (frames_ < FRAMES_LEAD_IN) {
float leadIn = bezierEaseInOut(frames_ * (1.0f / (float)FRAMES_LEAD_IN));
animatePos = leadIn;
} else if (finishFrame_ > 0) {
if (finishFrame_ >= 0) {
float leadOut = bezierEaseInOut((frames_ - finishFrame_) * (1.0f / (float)FRAMES_LEAD_OUT));
animatePos = 1.0f - leadOut;
@@ -266,6 +260,9 @@ void PopupScreen::update() {
// Actual finish happens here.
screenManager()->finishDialog(this, finishResult_);
}
} else if (frames_ < FRAMES_LEAD_IN) {
float leadIn = bezierEaseInOut(frames_ * (1.0f / (float)FRAMES_LEAD_IN));
animatePos = leadIn;
}
if (animatePos < 1.0f) {
+6 -1
View File
@@ -91,8 +91,13 @@ private:
std::string button1_;
std::string button2_;
enum {
FRAMES_LEAD_IN = 6,
FRAMES_LEAD_OUT = 4,
};
int frames_ = 0;
int finishFrame_ = 0;
int finishFrame_ = -1;
DialogResult finishResult_;
bool hasPopupOrigin_ = false;
Point popupOrigin_;