sproutcore 1.11.0.rc2 → 1.11.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG +10 -0
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/CHANGELOG.md +114 -1
  5. data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +1 -7
  6. data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +9 -9
  7. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +167 -5
  8. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +24 -8
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/stack_layout.js +737 -0
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +0 -6
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +11 -7
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -11
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +8 -3
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js +9 -6
  15. data/lib/frameworks/sproutcore/frameworks/{desktop/protocols/responder.js → core_foundation/protocols/responder_protocol.js} +83 -17
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/{sparse_array_delegate.js → sparse_array_delegate_protocol.js} +11 -7
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +11 -6
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +2 -2
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +0 -22
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +61 -56
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +2 -2
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +3 -3
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +63 -39
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +28 -28
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +10 -4
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +102 -1
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -4
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +103 -103
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/replaceAllChildren_test.js +1 -1
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +77 -1
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +18 -17
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +42 -49
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -6
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +16 -5
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +241 -102
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -4
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +0 -11
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +993 -610
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +3 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +6 -11
  41. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +94 -27
  42. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +133 -53
  43. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +30 -35
  44. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +3 -2
  45. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +73 -29
  46. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/conflictedStoreKeys_test.js +156 -0
  47. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +61 -37
  48. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +2 -2
  49. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +68 -39
  50. data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +1 -2
  51. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +8 -6
  52. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +80 -14
  53. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +2 -2
  54. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_data_source.js → drag_data_source_protocol.js} +16 -10
  55. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_source.js → drag_source_protocol.js} +28 -26
  56. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drop_target.js → drop_target_protocol.js} +73 -75
  57. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -4
  58. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +39 -23
  59. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +120 -97
  60. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowSizeForContentIndex.js +26 -25
  61. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +3 -3
  62. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +5 -0
  63. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/{dividers.js → dividers_test.js} +38 -38
  64. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +29 -14
  65. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +2 -1
  66. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +13 -18
  67. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +41 -35
  68. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +14 -14
  69. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +41 -26
  70. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -12
  71. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +2 -2
  72. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +14 -10
  73. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +104 -63
  74. data/lib/frameworks/sproutcore/frameworks/foundation/protocols/swap_transition_protocol.js +9 -4
  75. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +1 -2
  76. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +33 -33
  77. data/lib/frameworks/sproutcore/frameworks/foundation/tests/transitions/view_transitions_test.js +5 -5
  78. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +0 -4
  79. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +0 -4
  80. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +0 -2
  81. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +12 -8
  82. data/lib/frameworks/sproutcore/frameworks/media/resources/silence.mp3 +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/media/tests/audio.js +69 -0
  84. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +1 -0
  85. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  86. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +11 -4
  87. data/lib/frameworks/sproutcore/frameworks/runtime/protocols/mixin_protocol.js +150 -0
  88. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +447 -137
  89. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +9 -15
  90. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +19 -17
  91. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +188 -16
  92. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +1 -1
  93. data/lib/frameworks/sproutcore/frameworks/template_view/panes/template.js +0 -3
  94. data/lib/frameworks/sproutcore/frameworks/template_view/tests/panes/template.js +0 -17
  95. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +43 -26
  96. data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +9 -2
  97. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +0 -1
  98. data/lib/frameworks/sproutcore/themes/ace/resources/scroll/scroll.css +3 -0
  99. data/sproutcore.gemspec +3 -3
  100. metadata +19 -17
  101. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +0 -465
  102. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +0 -472
  103. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js +0 -87
  104. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +0 -89
@@ -63,12 +63,6 @@ SC.Pane.reopen(
63
63
  return wDim;
64
64
  },
65
65
 
66
- /** @private Disable caching due to an known bug in SC. */
67
- frame: function () {
68
- if (this.get('designer') && SC.suppressMain) { return sc_super(); }
69
- return this.computeFrameWithParentFrame(null);
70
- }.property(),
71
-
72
66
  /**
73
67
  Invoked by the root responder whenever the window resizes. This should
74
68
  simply begin the process of notifying children that the view size has
@@ -476,7 +476,9 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
476
476
  @returns {SC.Pane} receiver
477
477
  */
478
478
  remove: function() {
479
- this._doDetach();
479
+ if (this.get('isAttached')) {
480
+ this._doDetach();
481
+ }
480
482
 
481
483
  return this ;
482
484
  },
@@ -546,13 +548,15 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
546
548
  // and call sc_super() won't fail.
547
549
  },
548
550
 
549
- /**
550
- YES when the pane is currently attached to a document DOM. Read only.
551
+ /** @deprecated Version 1.11. Use `isAttached` instead. */
552
+ isPaneAttached: function () {
551
553
 
552
- @type Boolean
553
- @readOnly
554
- */
555
- isPaneAttached: NO,
554
+ //@if(debug)
555
+ SC.warn("Developer Warning: The `isPaneAttached` property of `SC.Pane` has been deprecated. Please use the `isAttached` property instead.");
556
+ //@endif
557
+
558
+ return this.get('isAttached');
559
+ }.property('isAttached').cacheable(),
556
560
 
557
561
  /**
558
562
  If YES, a touch intercept pane will be added above this pane when on
@@ -12,7 +12,7 @@ sc_require("panes/pane");
12
12
  SC.Pane.reopen({
13
13
 
14
14
  /** @private */
15
- _notifyDidAttach: function () {
15
+ _executeDoAttach: function () {
16
16
  // hook into root responder
17
17
  var responder = (this.rootResponder = SC.RootResponder.responder);
18
18
  responder.panes.add(this);
@@ -20,16 +20,17 @@ SC.Pane.reopen({
20
20
  // Update the currentWindowSize cache.
21
21
  this.set('currentWindowSize', responder.currentWindowSize);
22
22
 
23
+ // Set the initial design mode. The responder will update this if it changes.
24
+ this.updateDesignMode(this.get('designMode'), responder.get('currentDesignMode'));
25
+
26
+ sc_super();
27
+
23
28
  // Legacy.
24
- this.set('isPaneAttached', YES);
25
29
  this.paneDidAttach();
26
30
 
27
31
  // Legacy?
28
32
  this.recomputeDependentProperties();
29
33
 
30
- // Set the initial design mode. The responder will update this if it changes.
31
- this.updateDesignMode(this.get('designMode'), responder.get('currentDesignMode'));
32
-
33
34
  // handle intercept if needed
34
35
  this._addIntercept();
35
36
 
@@ -39,17 +40,12 @@ SC.Pane.reopen({
39
40
  // We call viewDidResize so that it calls parentViewDidResize on all child views.
40
41
  this.viewDidResize();
41
42
  }
42
-
43
- sc_super();
44
43
  },
45
44
 
46
45
  /** @private */
47
- _notifyWillDetach: function () {
46
+ _executeDoDetach: function () {
48
47
  sc_super();
49
48
 
50
- // Legacy.
51
- this.set('isPaneAttached', NO);
52
-
53
49
  // remove intercept
54
50
  this._removeIntercept();
55
51
 
@@ -4,9 +4,14 @@
4
4
  // License: Licensed under MIT license (see license.js)
5
5
  // ==========================================================================
6
6
 
7
- /**
8
- The SC.ChildViewLayoutProtocol defines the expected and optional properties
9
- and methods to implement in your own child view layout plugin.
7
+ /** @namespace
8
+ The `SC.ChildViewLayoutProtocol` protocol defines the properties and methods that you may
9
+ implement in your custom child view layout plugins. The only required method for a plugin to
10
+ implement is `layoutChildViews`.
11
+
12
+ *Note: Do not mix `SC.ChildViewLayoutProtocol` into your classes. As a protocol, it exists only
13
+ for reference sake. You only need define any of the properties or methods listed below in order to
14
+ use this protocol.*
10
15
  */
11
16
  SC.ChildViewLayoutProtocol = {
12
17
 
@@ -5,16 +5,19 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- /**
9
- The SC.ObservableProtocol defines optional methods you can implement on your
10
- objects. They will be used if defined but are not required for observing to
11
- work.
8
+ /** @namespace
9
+ The `SC.ObservableProtocol` protocol defines the properties and methods that you may implement
10
+ in your `SC.Observable` consumers (i.e. `SC.Object`) in order to access additional observer
11
+ functionality. They will be used if defined but are not required for observing to work.
12
+
13
+ *Note: Do not mix `SC.ObservableProtocol` into your classes. As a protocol, it exists only for
14
+ reference sake. You only need define any of the properties or methods listed below in order to use
15
+ this protocol.*
12
16
  */
13
17
  SC.ObservableProtocol = {
14
18
 
15
19
  /**
16
- Generic property observer called whenever a property on the receiver
17
- changes.
20
+ Generic property observer called whenever a property on the receiver changes.
18
21
 
19
22
  If you need to observe a large number of properties on your object, it
20
23
  is sometimes more efficient to implement this observer only and then to
@@ -5,18 +5,15 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
+ /** @namespace
9
+ The `SC.ResponderProtocol` protocol defines the properties and methods that you may implement
10
+ in your `SC.Responder` (i.e. `SC.View`) subclasses in order to handle specific responder chain
11
+ events.
8
12
 
9
- /** @static
13
+ *Note: Do not mix `SC.ResponderProtocol` into your classes. As a protocol, it exists only for
14
+ reference sake. You only need define any of the properties or methods listed below in order to use
15
+ this protocol.*
10
16
 
11
- This protocol defines the allowable responder methods. To implement a
12
- specific responder method, and a method with the correct signature to your
13
- class.
14
-
15
- **DO NOT INCLUDE THIS MIXIN**.
16
-
17
- If you try and include this mixin, an error will be raised on startup.
18
-
19
- @author Erich Ocean
20
17
  @since SproutCore 1.0
21
18
  */
22
19
  SC.ResponderProtocol = {
@@ -78,6 +75,14 @@ SC.ResponderProtocol = {
78
75
  */
79
76
  mouseMoved: function(evt) {},
80
77
 
78
+ /**
79
+ Called when a contextmenu event is triggered. Used to disable contextmenu
80
+ per view.
81
+
82
+ @param evt {SC.Event} the contextmenu event
83
+ @returns {void}
84
+ */
85
+ contextMenu: function(evt) {},
81
86
 
82
87
  /**
83
88
  Called when a selectstart event in IE is triggered. **ONLY IE**
@@ -88,17 +93,78 @@ SC.ResponderProtocol = {
88
93
  */
89
94
  selectStart: function(evt) {},
90
95
 
96
+ // .......................................................................
97
+ // Touch Event Handlers
98
+ //
99
+
91
100
  /**
92
- Called when a contextmenu event is triggered. Used to disable contextmenu
93
- per view.
101
+ Called when a touch begins. Capturing a touch is a special case behavior that allows for the
102
+ nesting of touch capable views. In some situations, an outer view may want to capture a touch
103
+ *before* the inner view acts on it. For example, a container view may want to act on swipes or
104
+ pinches, while the inner view may only respond to taps. If the normal event path was followed,
105
+ the inner view would get the `touchStart` event and by accepting it, would inadvertently prevent
106
+ the outer view from being able to act on it.
107
+
108
+ For this reason, when a touch begins, each view from the top-down has a chance to capture a
109
+ touch first, before it is passed to the bottom-most target view. For example, SC.ScrollView
110
+ captures touches so that it can determine if the touch is the beginning of a swipe or pinch. If
111
+ the touch does become one of these gestures, SC.ScrollView can act on it. However, if the touch
112
+ doesn't become one of these gestures, SC.ScrollView understands that it needs to pass the touch
113
+ to its children.
114
+
115
+ Therefore, implementors of `captureTouch` are expected to release the touch if they won't use it
116
+ by calling the touch's `captureTouch` method and passing themself as the new starting point
117
+ (capturing will continue from the implementor onward as it would have if the implementor hadn't
118
+ temporarily captured it).
119
+
120
+ Note, `captureTouch` is only meaningful for container type views where their children may
121
+ handle touches as well. For most controls that want to handle touch, there is no reason to
122
+ capture a touch, because they don't have any children. For these views, simply use the
123
+ `touchStart`, `touchesDragged`, `touchCancelled` and `touchEnd` methods.
124
+
125
+ @param touch {SC.Touch} the touch
126
+ @returns {Boolean} YES to claim the touch and receive touchStart, NO otherwise
127
+ @see SC.Touch#captureTouch
128
+ */
129
+ captureTouch: function (touch) {},
94
130
 
95
- @param evt {SC.Event} the contextmenu event
96
- @returns {void}
97
- */
98
- contextMenu: function(evt) {},
131
+ /**
132
+ Called when a touch previously claimed by returning `true` from `touchStart` is cancelled.
133
+
134
+ @param touch {SC.Touch} the touch
135
+ @returns {void}
136
+ */
137
+ touchCancelled: function (touch) {},
138
+
139
+ /**
140
+ Called when an active touch moves. The touches array contains all of the touches that this view
141
+ has claimed by returning `true` from `touchStart`.
142
+
143
+ @param evt {SC.Event} the event
144
+ @param touches {Array} the touches
145
+ @returns {void}
146
+ */
147
+ touchesDragged: function (evt, touches) {},
148
+
149
+ /**
150
+ Called when a touch previously claimed by returning `true` from `touchStart` ends.
151
+
152
+ @param touch {SC.Touch} the touch
153
+ @returns {void}
154
+ */
155
+ touchEnd: function (touch) {},
156
+
157
+ /**
158
+ Called when a touch begins. You must return `YES` to receive `touchesDragged` and `touchEnd` in
159
+ the future.
160
+
161
+ @param touch {SC.Touch} the touch
162
+ @returns {Boolean} YES to receive additional touch events, NO otherwise
163
+ */
164
+ touchStart: function (touch) {},
99
165
 
100
166
  // .......................................................................
101
- // Event Handlers
167
+ // Keyboard Event Handlers
102
168
  //
103
169
  // These methods are called by the input manager in response to keyboard
104
170
  // events. Most of these methods are defined here for you, but not actually
@@ -6,18 +6,22 @@
6
6
  // ==========================================================================
7
7
 
8
8
  /** @namespace
9
+ The `SC.SparseArrayDelegateProtocol` protocol defines the properties and methods that you may
10
+ implement in your sparse array delegate objects.
9
11
 
10
- Delegate that provides data for a sparse array. If you set the delegate for
11
- a sparse array to an object that implements one or more of these methods,
12
- they will be invoked by the sparse array to fetch data or to update the
13
- array content as needed.
12
+ An object that implements this protocol may act as a delegate that provides data for a sparse
13
+ array. The delegate is invoked by the sparse array to fetch data or to update the array content
14
+ as needed.
14
15
 
15
- Your object does not need to implement all of these methods, but it should
16
- at least implement the sparseArrayDidRequestIndex() method.
16
+ Your object does not need to implement all of these methods, but it should at least implement the `sparseArrayDidRequestIndex()` method.
17
+
18
+ *Note: Do not mix `SC.SparseArrayDelegateProtocol` into your classes. As a protocol, it exists
19
+ only for reference sake. You only need define any of the properties or methods listed below in
20
+ order to use this protocol.*
17
21
 
18
22
  @since SproutCore 1.0
19
23
  */
20
- SC.SparseArrayDelegate = {
24
+ SC.SparseArrayDelegateProtocol = {
21
25
 
22
26
  /**
23
27
  Invoked when an object requests the length of the sparse array and the
@@ -6,11 +6,16 @@
6
6
 
7
7
 
8
8
  /** @namespace
9
- This protocol defines the allowable transition plugin methods.
9
+ The `SC.ViewTransitionProtocol` protocol defines the properties and methods that you may
10
+ implement in your custom transition plugins. The only required method for a plugin to
11
+ implement is `run`.
10
12
 
11
- SC.View uses transition plugins to setup, execute and cleanup the
12
- swapping between views and expects the given transition plugin object
13
- to implement the methods in this protocol.
13
+ SC.View uses transition plugins to setup, execute and cleanup the swapping between views and
14
+ expects the given transition plugin object to implement this protocol.
15
+
16
+ *Note: Do not mix `SC.ViewTransitionProtocol` into your classes. As a protocol, it exists only
17
+ for reference sake. You only need define any of the properties or methods listed below in order to
18
+ use this protocol.*
14
19
  */
15
20
  SC.ViewTransitionProtocol = {
16
21
 
@@ -31,8 +36,8 @@ SC.ViewTransitionProtocol = {
31
36
  setup: function (view, options, inPlace) {},
32
37
 
33
38
  /**
34
- This method is called to transition the view in or visible (i.e.
35
- transitionIn or transitionShow).
39
+ This method is called to transition the view in or visible (i.e. transitionIn or
40
+ transitionShow).
36
41
 
37
42
  When the transition completes, this function *must* call `didTransitionIn()`
38
43
  on the view, passing this object and the original options as
@@ -47,7 +47,7 @@
47
47
  rgba values stay within the device's gamut (0 to 255 on a normal screen, and 0 to 1
48
48
  for alpha). For example, adding white to white will result in r, g and b values of
49
49
  510, a nonsensical value. (The `cssText` property will, however, correctly clamp the
50
- component values, and the color will output `#FFFFFF`.) This behavior is required
50
+ component values, and the color will output #FFFFFF.) This behavior is required
51
51
  for operations such as interpolating between colors (see "SC.Color and SC.View"
52
52
  below); it also gives SC.Color more predictable math, where A + B - B = A, even if
53
53
  the intermediate (A + B) operation results in underlying values outside of the normal
@@ -133,7 +133,7 @@
133
133
  ### Edge Case: Supporting Alpha in IE
134
134
 
135
135
  Supporting the alpha channel in older versions of IE requires a little extra work.
136
- The bindable `cssText` property will return valid ARGB (e.g. `#99FFFFFF`) when it
136
+ The bindable `cssText` property will return valid ARGB (e.g. #99FFFFFF) when it
137
137
  detects that it's in an older version of IE which requires it, but unfortunately you
138
138
  can't simply plug that value into `background-color`. The following code will detect
139
139
  this case and provide the correct CSS snippet:
@@ -37,31 +37,9 @@ SC.Page = SC.Object.extend(
37
37
  var value = this[key] ;
38
38
  if (value && value.isClass) {
39
39
  this[key] = value = value.create({ page: this }) ;
40
- if (!this.get('inDesignMode')) value.awake() ;
41
40
  return value ;
42
41
  } else return sc_super();
43
42
  },
44
-
45
- /**
46
- Finds all views defined on this page instances and builds them. This is
47
- a quick, brute force way to wake up all of the views in a page object. It
48
- is not generally recommended. Instead, you should use get() or getPath()
49
- to retrieve views and rely on the lazy creation process to set them up.
50
-
51
- @return {SC.Page} receiver
52
- */
53
- awake: function() {
54
- // step through all views and build them
55
- var value, key;
56
- for(key in this) {
57
- if (!this.hasOwnProperty(key)) continue ;
58
- value = this[key] ;
59
- if (value && value.isViewClass) {
60
- this[key] = value = value.create({ page: this }) ;
61
- }
62
- }
63
- return this;
64
- },
65
43
 
66
44
  /**
67
45
  Returns the named property unless the property is a view that has not yet
@@ -230,7 +230,7 @@ SC.RootResponder = SC.Object.extend(
230
230
  var candidate;
231
231
  while (previousKeyPanes.length > 0) {
232
232
  candidate = previousKeyPanes.pop();
233
- if (candidate.get('isPaneAttached') && candidate.get('acceptsKeyPane')) {
233
+ if (candidate.get('isVisibleInWindow') && candidate.get('acceptsKeyPane')) {
234
234
  newKeyPane = candidate ;
235
235
  break ;
236
236
  }
@@ -2108,33 +2108,37 @@ SC.RootResponder = SC.Object.extend(
2108
2108
  // First, save the click count. The click count resets if the mouse down
2109
2109
  // event occurs more than 250 ms later than the mouse up event or more
2110
2110
  // than 8 pixels away from the mouse down event or if the button used is different.
2111
- this._clickCount += 1 ;
2112
- if (!this._lastMouseUpAt || this._lastClickWhich !== evt.which || ((Date.now() - this._lastMouseUpAt) > 250)) {
2113
- this._clickCount = 1 ;
2114
- } else {
2115
- var deltaX = this._lastMouseDownX - evt.clientX,
2116
- deltaY = this._lastMouseDownY - evt.clientY,
2117
- distance = Math.sqrt(deltaX*deltaX + deltaY*deltaY) ;
2118
-
2119
- if (distance > 8.0) this._clickCount = 1 ;
2120
- }
2121
- evt.clickCount = this._clickCount ;
2122
-
2123
- this._lastClickWhich = evt.which;
2124
- this._lastMouseDownX = evt.clientX ;
2125
- this._lastMouseDownY = evt.clientY ;
2111
+ this._clickCount += 1;
2126
2112
 
2127
2113
  var view = this.targetViewForEvent(evt);
2128
2114
 
2129
2115
  view = this._mouseDownView = this.sendEvent('mouseDown', evt, view) ;
2130
2116
  if (view && view.respondsTo('mouseDragged')) this._mouseCanDrag = YES ;
2131
2117
 
2132
- // Determine if any views took responsibility for the
2133
- // event. If so, save that information so we can prevent
2134
- // the next click event we receive from propagating to the browser.
2118
+ // Determine if any views took responsibility for the event. If so, save that information so we
2119
+ // can prevent the next click event we receive from propagating to the browser.
2135
2120
  var ret = view ? evt.hasCustomEventHandling : YES;
2136
2121
  this._lastMouseDownCustomHandling = ret;
2137
2122
 
2123
+ // If it has been too long since the last click, the handler has changed or the mouse has moved
2124
+ // too far, reset the click count.
2125
+ if (!this._lastMouseUpAt || this._lastMouseDownView !== this._mouseDownView || ((Date.now() - this._lastMouseUpAt) > 250)) {
2126
+ this._clickCount = 1;
2127
+ } else {
2128
+ var deltaX = this._lastMouseDownX - evt.clientX,
2129
+ deltaY = this._lastMouseDownY - evt.clientY,
2130
+ distance = Math.sqrt(deltaX*deltaX + deltaY*deltaY) ;
2131
+
2132
+ if (distance > 8.0) this._clickCount = 1;
2133
+ }
2134
+ evt.clickCount = this._clickCount;
2135
+
2136
+ // Cache the handler and point of the last mouse down in order to determine whether a successive mouse down should
2137
+ // still increment the click count.
2138
+ this._lastMouseDownView = this._mouseDownView;
2139
+ this._lastMouseDownX = evt.clientX;
2140
+ this._lastMouseDownY = evt.clientY;
2141
+
2138
2142
  return ret;
2139
2143
  },
2140
2144
 
@@ -2159,41 +2163,41 @@ SC.RootResponder = SC.Object.extend(
2159
2163
  var view = this._mouseDownView,
2160
2164
  targetView = this.targetViewForEvent(evt);
2161
2165
 
2162
- // record click count.
2163
- evt.clickCount = this._clickCount ;
2166
+ // record click count.
2167
+ evt.clickCount = this._clickCount ;
2164
2168
 
2165
- // attempt the mouseup call only if there's a target.
2166
- // don't want a mouseup going to anyone unless they handled the mousedown...
2167
- if (view) {
2168
- handler = this.sendEvent('mouseUp', evt, view) ;
2169
+ // attempt the mouseup call only if there's a target.
2170
+ // don't want a mouseup going to anyone unless they handled the mousedown...
2171
+ if (view) {
2172
+ handler = this.sendEvent('mouseUp', evt, view) ;
2169
2173
 
2170
- // try doubleClick
2171
- if (!handler && (this._clickCount === 2)) {
2172
- handler = this.sendEvent('doubleClick', evt, view) ;
2173
- clickOrDoubleClickDidTrigger = YES;
2174
- }
2174
+ // try doubleClick
2175
+ if (!handler && this._clickCount === 2) {
2176
+ handler = this.sendEvent('doubleClick', evt, view) ;
2177
+ clickOrDoubleClickDidTrigger = YES;
2178
+ }
2175
2179
 
2176
- // try single click
2177
- if (!handler) {
2178
- handler = this.sendEvent('click', evt, view) ;
2179
- clickOrDoubleClickDidTrigger = YES;
2180
+ // try single click
2181
+ if (!handler) {
2182
+ handler = this.sendEvent('click', evt, view) ;
2183
+ clickOrDoubleClickDidTrigger = YES;
2184
+ }
2180
2185
  }
2181
- }
2182
2186
 
2183
- // try whoever's under the mouse if we haven't handle the mouse up yet
2184
- if (!handler && !clickOrDoubleClickDidTrigger) {
2187
+ // try whoever's under the mouse if we haven't handle the mouse up yet
2188
+ if (!handler && !clickOrDoubleClickDidTrigger) {
2185
2189
 
2186
- // try doubleClick
2187
- if (this._clickCount === 2) {
2188
- handler = this.sendEvent('doubleClick', evt, targetView);
2189
- }
2190
+ // try doubleClick
2191
+ if (this._clickCount === 2) {
2192
+ handler = this.sendEvent('doubleClick', evt, targetView);
2193
+ }
2190
2194
 
2191
- // try singleClick
2192
- if (!handler) {
2193
- handler = this.sendEvent('click', evt, targetView) ;
2195
+ // try singleClick
2196
+ if (!handler) {
2197
+ handler = this.sendEvent('click', evt, targetView) ;
2198
+ }
2194
2199
  }
2195
2200
  }
2196
- }
2197
2201
 
2198
2202
  // cleanup
2199
2203
  this._mouseCanDrag = NO;
@@ -2529,32 +2533,32 @@ SC.RootResponder = SC.Object.extend(
2529
2533
 
2530
2534
  /* @private Handler for animationstart events. */
2531
2535
  animationstart: function (evt) {
2532
- var view = this.targetViewForEvent(evt) ;
2533
- this.sendEvent('animationDidStart', evt, view) ;
2536
+ var view = this.targetViewForEvent(evt);
2537
+ this.sendEvent('animationDidStart', evt, view);
2534
2538
 
2535
2539
  return view ? evt.hasCustomEventHandling : YES;
2536
2540
  },
2537
2541
 
2538
2542
  /* @private Handler for animationiteration events. */
2539
2543
  animationiteration: function (evt) {
2540
- var view = this.targetViewForEvent(evt) ;
2541
- this.sendEvent('animationDidIterate', evt, view) ;
2544
+ var view = this.targetViewForEvent(evt);
2545
+ this.sendEvent('animationDidIterate', evt, view);
2542
2546
 
2543
2547
  return view ? evt.hasCustomEventHandling : YES;
2544
2548
  },
2545
2549
 
2546
2550
  /* @private Handler for animationend events. */
2547
2551
  animationend: function (evt) {
2548
- var view = this.targetViewForEvent(evt) ;
2549
- this.sendEvent('animationDidEnd', evt, view) ;
2552
+ var view = this.targetViewForEvent(evt);
2553
+ this.sendEvent('animationDidEnd', evt, view);
2550
2554
 
2551
2555
  return view ? evt.hasCustomEventHandling : YES;
2552
2556
  },
2553
2557
 
2554
2558
  /* @private Handler for transitionend events. */
2555
2559
  transitionend: function (evt) {
2556
- var view = this.targetViewForEvent(evt) ;
2557
- this.sendEvent('transitionDidEnd', evt, view) ;
2560
+ var view = this.targetViewForEvent(evt);
2561
+ this.sendEvent('transitionDidEnd', evt, view);
2558
2562
 
2559
2563
  return view ? evt.hasCustomEventHandling : YES;
2560
2564
  }
@@ -2565,8 +2569,9 @@ SC.RootResponder = SC.Object.extend(
2565
2569
  Invoked when the document is ready, but before main is called. Creates
2566
2570
  an instance and sets up event listeners as needed.
2567
2571
  */
2568
- SC.ready(SC.RootResponder, SC.RootResponder.ready = function() {
2572
+ SC.ready(SC.RootResponder, SC.RootResponder.ready = function () {
2569
2573
  var r;
2570
- r = SC.RootResponder.responder = SC.RootResponder.create() ;
2571
- r.setup() ;
2574
+
2575
+ r = SC.RootResponder.responder = SC.RootResponder.create();
2576
+ r.setup();
2572
2577
  });