23 if (tab.ModalController_state == 1)
25 tab.parent.hideAll(tab.parent, 0);
26 button.forcePressed =
true;
27 tab.ModalController_controllingButton = button;
28 tab.parent.showChild(tab.parent, tab, button.origin, button.size, 0);
38 if (tab.ModalController_state)
41 button.forcePressed =
true;
42 if (tab.parent.focusedChild)
43 tab.parent.focusedChild.saveFocus(tab.parent.focusedChild);
44 tab.ModalController_controllingButton = button;
45 tab.parent.showChild(tab.parent, tab, theOrigin, theSize, 0);
60 float previousState =
other.ModalController_state;
61 if (
state == previousState && !skipAnimation)
67 other.ModalController_factor = 1 -
other.Container_alpha /
other.ModalController_initialAlpha;
71 other.ModalController_factor =
other.Container_alpha /
other.ModalController_initialAlpha;
72 if (previousState == 0 && !skipAnimation)
74 other.Container_origin =
other.ModalController_buttonOrigin;
75 other.Container_size =
other.ModalController_buttonSize;
80 other.ModalController_factor =
bound(0, (1 -
other.Container_alpha /
other.ModalController_initialAlpha) / me.fadedAlpha, 1);
84 if (skipAnimation)
other.ModalController_factor = 1;
92 float prevFactor, targetFactor;
93 vector targetOrigin, targetSize;
97 for (e = me.firstChild; e; e = e.nextSibling)
98 if (e.ModalController_state)
101 me.switchState(me, front, 2, 0);
105 me.switchState(me, front, 1, 0);
109 bool animating =
false;
110 for (e = me.firstChild; e; e = e.nextSibling)
112 if (e.ModalController_state == 2)
115 targetOrigin = e.Container_origin;
116 targetSize = e.Container_size;
117 targetAlpha = me.fadedAlpha * e.ModalController_initialAlpha;
119 else if (e.ModalController_state == 1)
122 targetOrigin = e.ModalController_initialOrigin;
123 targetSize = e.ModalController_initialSize;
124 targetAlpha = e.ModalController_initialAlpha;
129 targetOrigin = e.Container_origin;
130 targetSize = e.Container_size;
134 f = (e.ModalController_factor =
min(1, e.ModalController_factor + df));
139 e.Container_origin = targetOrigin;
140 e.Container_size = targetSize;
141 me.setAlphaOf(me, e, targetAlpha);
145 prevFactor = (1 - f) / (1 - f + df);
146 if (!e.ModalController_state)
147 me.setAlphaOf(me, e, e.Container_alpha * prevFactor);
151 targetFactor = df / (1 - f + df);
153 if (e.ModalController_state == 1)
155 e.Container_origin = e.Container_origin * prevFactor + targetOrigin * targetFactor;
156 e.Container_size = e.Container_size * prevFactor + targetSize * targetFactor;
158 me.setAlphaOf(me, e, e.Container_alpha * prevFactor + targetAlpha * targetFactor);
169 if (e.ModalController_state == 1)
172 e.Container_fontscale.x = fs.x * e.ModalController_initialFontScale.x;
173 e.Container_fontscale.y = fs.y * e.ModalController_initialFontScale.y;
177 if (animating || !me.focused)
178 me.setFocus(me,
NULL);
180 me.setFocus(me, front);