23 if (tab.ModalController_state == 1)
return;
24 tab.parent.hideAll(tab.parent, 0);
25 button.forcePressed =
true;
26 tab.ModalController_controllingButton = button;
27 tab.parent.showChild(tab.parent, tab, button.origin, button.size, 0);
37 if (tab.ModalController_state)
return;
38 if (button) button.forcePressed =
true;
39 if (tab.parent.focusedChild) tab.parent.focusedChild.saveFocus(tab.parent.focusedChild);
40 tab.ModalController_controllingButton = button;
41 tab.parent.showChild(tab.parent, tab, theOrigin, theSize, 0);
57 previousState =
other.ModalController_state;
58 if (
state == previousState && !skipAnimation)
return;
63 other.ModalController_factor = 1 -
other.Container_alpha /
other.ModalController_initialAlpha;
67 other.ModalController_factor =
other.Container_alpha /
other.ModalController_initialAlpha;
68 if (previousState == 0 && !skipAnimation)
70 other.Container_origin =
other.ModalController_buttonOrigin;
71 other.Container_size =
other.ModalController_buttonSize;
76 other.ModalController_factor =
bound(0, (1 -
other.Container_alpha /
other.ModalController_initialAlpha) / me.fadedAlpha, 1);
80 if (skipAnimation)
other.ModalController_factor = 1;
90 float prevFactor, targetFactor;
91 vector targetOrigin, targetSize;
97 for (e = me.firstChild; e; e = e.nextSibling)
98 if (e.ModalController_state)
100 if (front) me.switchState(me, front, 2, 0);
103 if (front) me.switchState(me, front, 1, 0);
107 for (e = me.firstChild; e; e = e.nextSibling)
109 if (e.ModalController_state == 2)
112 targetOrigin = e.Container_origin;
113 targetSize = e.Container_size;
114 targetAlpha = me.fadedAlpha * e.ModalController_initialAlpha;
116 else if (e.ModalController_state == 1)
119 targetOrigin = e.ModalController_initialOrigin;
120 targetSize = e.ModalController_initialSize;
121 targetAlpha = e.ModalController_initialAlpha;
126 targetOrigin = e.Container_origin;
127 targetSize = e.Container_size;
131 f = (e.ModalController_factor =
min(1, e.ModalController_factor + df));
136 e.Container_origin = targetOrigin;
137 e.Container_size = targetSize;
138 me.setAlphaOf(me, e, targetAlpha);
142 prevFactor = (1 - f) / (1 - f + df);
143 if (!e.ModalController_state)
145 me.setAlphaOf(me, e, e.Container_alpha * prevFactor);
150 targetFactor = df / (1 - f + df);
152 if (e.ModalController_state == 1)
154 e.Container_origin = e.Container_origin * prevFactor + targetOrigin * targetFactor;
155 e.Container_size = e.Container_size * prevFactor + targetSize * targetFactor;
157 me.setAlphaOf(me, e, e.Container_alpha * prevFactor + targetAlpha * targetFactor);
168 if (e.ModalController_state == 1)
171 e.Container_fontscale_x = fs.x * e.ModalController_initialFontScale.x;
172 e.Container_fontscale_y = fs.y * e.ModalController_initialFontScale.y;
176 if (animating || !me.focused) me.setFocus(me,
NULL);
177 else me.setFocus(me, front);