Skip to content
Browse files

Fixes a problem with destroying SC.ContainerViews leftover after the …

…API for transitions was changed to share one transition plugin between all the content. Also updates the statechart diagram.
  • Loading branch information...
1 parent 623f25e commit 5874d7c4033cf91f9dfdf77e2daf5e41c0c36963 @publickeating publickeating committed Jan 3, 2013
Showing with 36 additions and 35 deletions.
  1. +29 −26 design/SC.ContainerView Statechart.graffle
  2. +7 −9 frameworks/foundation/views/container.js
View
55 design/SC.ContainerView Statechart.graffle
@@ -26,7 +26,7 @@
<key>MasterSheets</key>
<array/>
<key>ModificationDate</key>
- <string>2013-01-02 17:43:02 +0000</string>
+ <string>2013-01-04 04:56:36 +0000</string>
<key>Modifier</key>
<string>Tyler Keating</string>
<key>NotesVisible</key>
@@ -1367,7 +1367,7 @@ enter:
<array>
<dict>
<key>Bounds</key>
- <string>{{523.28092967257385, 316.50001430511526}, {48, 24}}</string>
+ <string>{{512.44899940808523, 316.50001430511526}, {156, 24}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -1393,7 +1393,7 @@ enter:
<key>ID</key>
<integer>103</integer>
<key>Position</key>
- <real>0.228907510638237</real>
+ <real>0.29259568452835083</real>
<key>RotationType</key>
<integer>0</integer>
</dict>
@@ -1421,7 +1421,8 @@ enter:
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
\f0\i\fs24 \cf0 do
-\i0\b exit}</string>
+\i0\b exit
+\b0 (immediately=false)}</string>
</dict>
<key>Wrap</key>
<string>NO</string>
@@ -1452,7 +1453,7 @@ enter:
<key>Points</key>
<array>
<string>{471.000004529953, 328.50001430511526}</string>
- <string>{660.50000055879354, 480}</string>
+ <string>{735.50000055879354, 480.00001525878906}</string>
</array>
<key>Style</key>
<dict>
@@ -1588,7 +1589,7 @@ enter:
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
-\f0\fs24 \cf0 Each content view has its own SC.ContainerContentStatechart statechart that is generated when the view is added. The content view statecharts are managed by the container view.}</string>
+\f0\fs24 \cf0 Each content view has its own SC.ContainerContentStatechart statechart that is generated when the view is added. The content statecharts are managed by the container view.}</string>
<key>VerticalPad</key>
<integer>0</integer>
</dict>
@@ -1600,7 +1601,7 @@ enter:
<array>
<dict>
<key>Bounds</key>
- <string>{{895, 597}, {11, 11}}</string>
+ <string>{{1036, 596.75001525878906}, {11, 11}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -1651,7 +1652,7 @@ enter:
</dict>
<dict>
<key>Bounds</key>
- <string>{{890, 592}, {21, 21}}</string>
+ <string>{{1031, 591.75001525878906}, {21, 21}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -1703,7 +1704,7 @@ enter:
</dict>
<dict>
<key>Bounds</key>
- <string>{{631.09999929914534, 606}, {48, 24}}</string>
+ <string>{{587.16434411783644, 608}, {156, 24}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -1729,7 +1730,7 @@ enter:
<key>ID</key>
<integer>94</integer>
<key>Position</key>
- <real>0.57944595813751221</real>
+ <real>0.65222305059432983</real>
<key>RotationType</key>
<integer>0</integer>
</dict>
@@ -1757,7 +1758,8 @@ enter:
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
\f0\i\fs24 \cf0 do
-\i0\b exit}</string>
+\i0\b exit
+\b0 (immediately=false)}</string>
</dict>
<key>Wrap</key>
<string>NO</string>
@@ -1786,12 +1788,12 @@ enter:
<key>OrthogonalBarPoint</key>
<string>{0, 0}</string>
<key>OrthogonalBarPosition</key>
- <real>-1</real>
+ <real>58.549999237060547</real>
<key>Points</key>
<array>
- <string>{623.00000000000034, 547.49998390674591}</string>
- <string>{643, 618}</string>
- <string>{698, 570}</string>
+ <string>{698.00000000000034, 547.49999916553497}</string>
+ <string>{569, 620}</string>
+ <string>{773, 570.00001525878906}</string>
</array>
<key>Style</key>
<dict>
@@ -1828,7 +1830,7 @@ enter:
</dict>
<dict>
<key>Bounds</key>
- <string>{{810.39999961853027, 537.74099797950396}, {43, 24}}</string>
+ <string>{{918.39999961853027, 549.60677392056527}, {43, 24}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -1854,7 +1856,7 @@ enter:
<key>ID</key>
<integer>92</integer>
<key>Position</key>
- <real>0.42396274209022522</real>
+ <real>0.4933876097202301</real>
<key>RotationType</key>
<integer>0</integer>
</dict>
@@ -1908,11 +1910,11 @@ enter:
<key>OrthogonalBarPoint</key>
<string>{0, 0}</string>
<key>OrthogonalBarPosition</key>
- <real>46.599998474121094</real>
+ <real>79.599998474121094</real>
<key>Points</key>
<array>
- <string>{773, 525.00001430511531}</string>
- <string>{890, 602.5}</string>
+ <string>{848, 525.00002956390438}</string>
+ <string>{1031, 602.25001525878906}</string>
</array>
<key>Style</key>
<dict>
@@ -1949,7 +1951,7 @@ enter:
</dict>
<dict>
<key>Bounds</key>
- <string>{{512.01835942534308, 512.99999965183065}, {48, 24}}</string>
+ <string>{{500.81554004600673, 513.00000468024848}, {156, 24}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -1975,7 +1977,7 @@ enter:
<key>ID</key>
<integer>90</integer>
<key>Position</key>
- <real>0.42396268248558044</real>
+ <real>0.47263514995574951</real>
<key>RotationType</key>
<integer>0</integer>
</dict>
@@ -2003,7 +2005,8 @@ enter:
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
\f0\i\fs24 \cf0 do
-\i0\b exit}</string>
+\i0\b exit
+\b0 (immediately=false)}</string>
</dict>
<key>Wrap</key>
<string>NO</string>
@@ -2034,7 +2037,7 @@ enter:
<key>Points</key>
<array>
<string>{472.00000000000006, 525.00001430511531}</string>
- <string>{623.00000000000034, 524.99997854232788}</string>
+ <string>{698.00000000000034, 524.99999380111694}</string>
</array>
<key>Style</key>
<dict>
@@ -2251,7 +2254,7 @@ enter:
</dict>
<dict>
<key>Bounds</key>
- <string>{{623, 480}, {150, 90}}</string>
+ <string>{{698, 480.00001525878906}, {150, 90}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FontInfo</key>
@@ -2500,7 +2503,7 @@ Exiting}</string>
</dict>
<dict>
<key>Bounds</key>
- <string>{{248, 175}, {724, 471}}</string>
+ <string>{{208, 174.75001525878906}, {944, 471}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
View
16 frameworks/foundation/views/container.js
@@ -223,8 +223,7 @@ SC.ContainerView = SC.View.extend(
// Exit all the statecharts immediately. This mutates the array!
for (var i = contentStatecharts.length - 1; i >= 0; i--) {
- contentStatecharts[i].set('transition', null);
- contentStatecharts[i].doExit();
+ contentStatecharts[i].doExit(true);
}
// Remove our internal reference to the statecharts.
@@ -276,8 +275,7 @@ SC.ContainerView = SC.View.extend(
// Exit all other remaining statecharts immediately. This mutates the array!
for (var i = contentStatecharts.length - 2; i >= 0; i--) {
- contentStatecharts[i].set('transition', null);
- contentStatecharts[i].doExit();
+ contentStatecharts[i].doExit(true);
}
this.set('isTransitioning', NO);
@@ -397,9 +395,9 @@ SC.ContainerContentStatechart = SC.Object.extend({
}
},
- doExit: function () {
+ doExit: function (immediately) {
if (this.state !== 'exited') {
- this.gotoExitingState();
+ this.gotoExitingState(immediately);
//@if(debug)
} else {
SC.error('Developer Error: SC.ContainerView should not receive an internal doExit event while in exited state.');
@@ -450,14 +448,14 @@ SC.ContainerContentStatechart = SC.Object.extend({
},
// Exiting
- gotoExitingState: function () {
+ gotoExitingState: function (immediately) {
var container = this.get('container'),
content = this.get('content'),
exitCount = this._exitCount,
options = container.get('transitionOptions') || {},
transition = container.get('transition');
- if (!!content && !!transition) {
+ if (!immediately && !!content && !!transition) {
if (this.state === 'entering') {
if (!!transition.buildInDidCancel) {
transition.buildInDidCancel(container, content, options);
@@ -472,7 +470,7 @@ SC.ContainerContentStatechart = SC.Object.extend({
// Assign the state.
this.state = 'exiting';
- if (!!content && !!transition) {
+ if (!immediately && !!content && !!transition) {
// Re-entering the exiting state may need to accelerate the transition, pass the count to the plugin.
if (!exitCount) { exitCount = this._exitCount = 1; }

0 comments on commit 5874d7c

Please sign in to comment.
Something went wrong with that request. Please try again.