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);
56 float previousState =
other.ModalController_state;
57 if (
state == previousState && !skipAnimation)
return;
62 other.ModalController_factor = 1 -
other.Container_alpha /
other.ModalController_initialAlpha;
66 other.ModalController_factor =
other.Container_alpha /
other.ModalController_initialAlpha;
67 if (previousState == 0 && !skipAnimation)
69 other.Container_origin =
other.ModalController_buttonOrigin;
70 other.Container_size =
other.ModalController_buttonSize;
75 other.ModalController_factor =
bound(0, (1 -
other.Container_alpha /
other.ModalController_initialAlpha) / me.fadedAlpha, 1);
79 if (skipAnimation)
other.ModalController_factor = 1;
89 float prevFactor, targetFactor;
90 vector targetOrigin, targetSize;
96 for (e = me.firstChild; e; e = e.nextSibling)
97 if (e.ModalController_state)
99 if (front) me.switchState(me, front, 2, 0);
102 if (front) me.switchState(me, front, 1, 0);
106 for (e = me.firstChild; e; e = e.nextSibling)
108 if (e.ModalController_state == 2)
111 targetOrigin = e.Container_origin;
112 targetSize = e.Container_size;
113 targetAlpha = me.fadedAlpha * e.ModalController_initialAlpha;
115 else if (e.ModalController_state == 1)
118 targetOrigin = e.ModalController_initialOrigin;
119 targetSize = e.ModalController_initialSize;
120 targetAlpha = e.ModalController_initialAlpha;
125 targetOrigin = e.Container_origin;
126 targetSize = e.Container_size;
130 f = (e.ModalController_factor =
min(1, e.ModalController_factor + df));
135 e.Container_origin = targetOrigin;
136 e.Container_size = targetSize;
137 me.setAlphaOf(me, e, targetAlpha);
141 prevFactor = (1 - f) / (1 - f + df);
142 if (!e.ModalController_state)
144 me.setAlphaOf(me, e, e.Container_alpha * prevFactor);
149 targetFactor = df / (1 - f + df);
151 if (e.ModalController_state == 1)
153 e.Container_origin = e.Container_origin * prevFactor + targetOrigin * targetFactor;
154 e.Container_size = e.Container_size * prevFactor + targetSize * targetFactor;
156 me.setAlphaOf(me, e, e.Container_alpha * prevFactor + targetAlpha * targetFactor);
167 if (e.ModalController_state == 1)
170 e.Container_fontscale_x = fs.x * e.ModalController_initialFontScale.x;
171 e.Container_fontscale_y = fs.y * e.ModalController_initialFontScale.y;
175 if (animating || !me.focused) me.setFocus(me,
NULL);
176 else me.setFocus(me, front);