sproutcore 1.11.0.rc3 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +6 -14
  2. data/CHANGELOG +5 -0
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/Buildfile +3 -2
  5. data/lib/frameworks/sproutcore/CHANGELOG.md +59 -10
  6. data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +1 -0
  7. data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +9 -4
  8. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +1 -1
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +0 -10
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +1 -1
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +10 -45
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +3 -3
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +76 -0
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/{touch.js → touch_test.js} +64 -0
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +1 -1
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +61 -24
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +1 -2
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js +0 -3
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/{layoutStyle.js → layout_style_test.js} +4 -4
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout_test.js +602 -0
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +0 -23
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +18 -17
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -5
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +64 -24
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +904 -871
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -3
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +40 -24
  28. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +2 -2
  29. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +5 -5
  30. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +14 -14
  31. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -2
  33. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +36 -33
  34. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +1 -1
  35. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +6 -6
  36. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +1 -1
  37. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +1 -1
  38. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +7 -7
  39. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +2 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +2 -2
  41. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +4 -4
  42. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +11 -11
  43. data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
  44. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +30 -1
  45. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +12 -1
  46. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +5 -3
  47. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +0 -36
  48. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +3 -3
  49. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
  50. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +1 -1
  51. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch_gesture.js +286 -0
  52. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe_gesture.js +449 -0
  53. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap_gesture.js +259 -0
  54. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +218 -30
  55. data/lib/frameworks/sproutcore/frameworks/foundation/system/gesture.js +259 -158
  56. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +58 -50
  57. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +1 -1
  58. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/pinch_gesture_test.js +321 -0
  59. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/swipe_gesture_test.js +154 -0
  60. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/tap_gesture_test.js +55 -0
  61. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/gesturable_test.js +233 -0
  62. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -2
  63. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/gesture_test.js +254 -0
  64. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +1 -0
  65. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +1 -1
  66. data/lib/frameworks/sproutcore/frameworks/legacy/object_keys_polyfill.js +51 -0
  67. data/lib/frameworks/sproutcore/frameworks/{core_foundation/system/req_anim_frame.js → legacy/request_animation_frame_polyfill.js} +10 -3
  68. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +19 -25
  69. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +7 -7
  70. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +3 -3
  71. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +9 -9
  72. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  73. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +2 -2
  74. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +1 -1
  75. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +1 -1
  76. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
  77. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +2 -2
  78. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +66 -5
  79. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/tree.js +44 -0
  80. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +4 -1
  81. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +0 -25
  82. data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +1 -1
  83. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +67 -15
  84. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -11
  85. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +6 -6
  86. data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +1 -1
  87. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/{observable.js → observable_test.js} +110 -16
  88. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +21 -0
  89. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +2 -2
  90. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars.js +1 -1
  91. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +1 -1
  92. data/lib/sproutcore/render_engines/haml.rb +1 -1
  93. metadata +610 -604
  94. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +0 -210
  95. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +0 -275
  96. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +0 -119
  97. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +0 -234
  98. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +0 -157
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzljNWViZTUxOTllNmJmYjllOWU4MmMyMTk4Mzk5YjhiM2MyM2JjYw==
5
- data.tar.gz: !binary |-
6
- OWM0MmI4YmIwMGQ4ZTM2NmFhOTk1NTRmZWQ2ZjFmYzJmZWY3NTk0Yw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZDlkNzk0OWMyZTNjYzk2NjdlZmZmYjdkMmZjNjQ2ZGI4N2NhOWEzZmNhZTg5
10
- YjA2OTQxMjVjNTc2OWYxOGI2ZWEyN2U1OTIwMmU5NDkwNWMzYWRlMTVkODcx
11
- ZTgxNzI0MWIxMTU2NmRjYzIwMjJjOTEzMjI2OTMzNjNkNmQ2YzQ=
12
- data.tar.gz: !binary |-
13
- NDQyZGYxMTMxMTQ1YmJjZjZlMGZmZDNjNGQyZDE4MGYyMzhiZWViNWE5Mjdi
14
- MjhjODE1N2M0ZDE1NTY1NGI4YTc4MTVkNTljMmNmOTIxZTVlMzIwODNkMjYy
15
- N2Q2M2ZhZTM5ZGNkMTVlMzcyNTc1NGM4NGE2NGI4YzlhMDBiZmI=
2
+ SHA1:
3
+ metadata.gz: e3a3babfc3cb453226d572bfd3ad71707cc3daa4
4
+ data.tar.gz: 907d56b7c9861cb71890ccd201e2f1378e4118b6
5
+ SHA512:
6
+ metadata.gz: 598115c0544161273f6241184b39a551100581af3e322bafed769fce30d54d9825bc3405fcfd3fdd7e38625599dcb129148230ffbc9f346ca485dc37328c5916
7
+ data.tar.gz: 213a9c81419f4d7e46638a4d8aa4d186da5e996b4cb948bdac8c9bf2741093381c55598a92390b222e99ac0d382a986e1af3ba2997c747a2ab775d5b0921c1a1
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ SproutCore 1.11.0
2
+ -----------------
3
+
4
+ * Updated HAML code to work with HAML 4.x.
5
+
1
6
  SproutCore 1.11.0.rc3
2
7
  -----------------
3
8
 
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 11
4
- :patch: 0.rc3
4
+ :patch: 0
@@ -39,7 +39,8 @@ config :routing, :required => [:core_foundation]
39
39
  config :foundation, :required => [:routing, :core_foundation, :datetime, :'datetime/localized', :ajax]
40
40
  config :datastore, :required => [:runtime, :datetime]
41
41
  config :formatters, :required => [:runtime, :foundation]
42
- config :desktop, :required => [:foundation]
42
+ config :desktop, :required => [:foundation], :test_required => [:legacy]
43
+ config :legacy, :required => [:desktop]
43
44
  config :media, :required => [:desktop]
44
45
  config :statechart, :required => [:core_foundation], :test_required => [:core_foundation, :desktop, :routing]
45
46
  config :ajax, :required => [:core_foundation]
@@ -50,7 +51,7 @@ config :"experimental/split_view", :test_required => [:desktop]
50
51
 
51
52
  # WRAPPER FRAMEWORKS
52
53
  config :sproutcore,
53
- :required => [:desktop, :datastore, :statechart],
54
+ :required => [:legacy, :datastore, :statechart],
54
55
  :exclude => ['phantomjs']
55
56
 
56
57
  config :qunit, :required => []
@@ -9,18 +9,62 @@ Edge
9
9
  ### DEPRECATIONS & REMOVALS
10
10
  ### BUG FIXES
11
11
 
12
+ 1.11.0
13
+ -----------
14
+
15
+ ### NEW FEATURES
16
+
17
+ #### General
18
+
19
+ * The `hasObserverFor` method of `SC.Observable` has been improved to also be able to optionally check against a specific target and method. This allows the developer to properly check for the existence of a specific handler before adding it rather than only being able to check for the existence of any handler (without knowing which handler it is).
20
+
21
+ ### CHANGES & IMPROVEMENTS
22
+
23
+ #### SC.Gesturable & SC.Gesture (SC.TapGesture, SC.PinchGesture, SC.SwipeGesture)
24
+
25
+ After some investigation, it was found that there were a number of issues with the built-in gesture support. For example, two touch taps would throw an exception, pinches would fail to register and in particular, supporting multiple gestures failed in a number of scenarios. In order to fix these problems, the gesture code has been rewritten from the top-down.
26
+
27
+ It is now possible to mixin SC.Gesturable to a view and use events to react to multiple gestures concurrently. Examples of the advanced type of behavior that the gesture code allows include:
28
+
29
+ * Responding to single finger, two finger or any other number of touch taps, pinches (2+ touches) or swipes individually or as a group. For example, your code may want to perform different actions when a single finger taps vs. when there is a two finger tap.
30
+ * A touch session, the time between when the first touch begins and the last touch ends, may contain more than one gesture. For example, it's possible for the user to perform a pinch, then use a third finger to tap, then swipe the remaining fingers. For example, imagine using pinch to scale an image, tap to save the change and then swipe to move it aside all without lifting the fingers. At the least, the ability to perform gestures in a single touch session multiple times, makes the gesture recognition more robust against stray accidental touches.
31
+ * Swipe gestures can now be configured to match against any arbitrary angles, not just left, right, up & down.
32
+ * Swipe gestures no longer trigger by simply moving far enough in one direction. They must also move quickly (configurable) and end immediately.
33
+
34
+ *How does this affect your code?*
35
+
36
+ For the most part, this should have no effect on existing implementors of SC.Gesturable. The three built-in gestures: SC.TapGesture, SC.PinchGesture, and SC.SwipeGesture are still defined and they work much better than before. However if you have defined a custom SC.Gesture subclass, it will unfortunately not work correctly with this update. Because we felt the previous version of SC.Gesture's API was too complex and incompatible with the behavior we needed to achieve, we decided it was better to rewrite it in a simpler form. We're very sorry for this backwards incompatibility, but because of the previous issues with gestures, we believe no one was able to use them anyway.
37
+
38
+ #### Legacy Framework
39
+
40
+ There is now a sub-framework within SproutCore, `:'sproutcore/legacy'`, which is meant to contain all code providing support for older browsers. This includes the existing polyfill for `window.requestAnimationFrame` and a brand new polyfill for `Object.keys`. The legacy framework is included by default by requiring `:sproutcore` in a project's or an app's Buildfile. The legacy framework itself requires the `:sproutcore/desktop` framework, which allows for any legacy code in the SproutCore controls to be separated out.
41
+
42
+ Therefore, to build an app that will only work with the newest browsers (probably not a great idea —), you may change your Buildfile requirements to include only the specific SproutCore sub-frameworks you need. For example,
43
+
44
+ config :my_app, :required => [:"sproutcore/desktop", :"sproutcore/datastore"]
45
+
46
+ ### DEPRECATIONS & REMOVALS
47
+
48
+ * The `owner` property of SC.View has been deprecated for general use. This property is identical to the existing `parentView` property on all views. It existed in order for some ancestor view to claim ownership of a descendent view, so that the descendent could reference the ancestor directly as `owner` rather than using some chain like `parentView.parentView...`. However, this type of connection can still be achieved by the an ancestor simply assigning `owner`, or whichever property they want to use, none-the-less and there's no need for every single SC.View to have it assigned.
49
+
50
+ Note: This deprecation will show a console warning in debug (i.e. non-production) mode.
51
+
52
+ ### BUG FIXES
53
+
54
+ * Fixed several regressions from previous release candidates.
55
+
12
56
  1.11.0.rc3
13
57
  -----------
14
58
 
15
59
  ### NEW FEATURES
16
60
 
17
- * *SC.NestedStore*
61
+ #### SC.NestedStore
18
62
 
19
63
  `SC.NestedStore` has a new property, `conflictedStoreKeys`, which is an array of all store keys that currently have conflicts with the nested store's parent. A conflict in a nested store can occur when the data in the parent store changes *after* the nested store has accessed and modified it.
20
64
 
21
65
  For instance, in a multi-user system where records can be edited by multiple people at the same time, the client may use polling or websockets to update the records in the main store asynchronously in the background. With such a scenario it would be possible for the current user to be editing a record that someone else has changed in the meantime. If the client attempted to commit the changes from the nested store it would get an exception because of the conflict. Instead, the developer can now check the value of `conflictedStoreKeys` and if it is `null`, then commit the changes and if it is an array of store keys, then they know which records have conflicts and can deal with them directly.
22
66
 
23
- * *SC.Binding*
67
+ #### SC.Binding
24
68
 
25
69
  There are two new binding transforms, `string` and `integer`, that ensure the value is *always* a `String` or an integer `Number`. Examples include returning an empty `String` for `null` or `undefined` values when using the `string` transform and returning a 0 for these same values when using the `integer` transform. Furthermore, if the `integer` transform is given a String, it will be parsed to an integer `Number` according to the extra argument `radix` (which is 10 by default).
26
70
 
@@ -50,27 +94,31 @@ For example, to create a mix binding that concatenates two external properties i
50
94
 
51
95
  })
52
96
 
97
+ #### General
98
+
53
99
  * *Updated Description* Scale is now a first-class layout property, correctly impacting `frame` and `clippingFrame`. If a view is scaled, the width & height of the frame will be correct as the view appears. For example, a view with layout equal to `{ width: 100, height: 100, scale: 2 }` will report a frame of `{ x: 0, y: 0, width: 200, height: 200, scale: 2 }`. The scale also takes a scaling origin into account as well and as part of this change, there are two new layout properties: `transformOriginX` and `transformOriginY`, which define the percentage (between 0.0 and 1.0) on the respective axis about which the scale transform is applied. These properties affect all transform styles and so can be used to also change the origin of a rotate style.
54
100
 
55
101
  ### CHANGES & IMPROVEMENTS
56
102
 
57
- * Documentation
103
+ #### Documentation
58
104
 
59
- ** Added lots of documentation to `SC.Request` (examples), `SC.Query` (local vs. remote) and `SC.DateTime` (`adjust` and `advance`).
60
- ** Cleaned up documentation of all protocols, including a warning not to mix in protocols and fixed some problems that prevented some protocols from being properly generated on docs.sproutcore.com.
61
- ** Added `SC.ObjectMixinProtocol` with documentation on using mixins with `SC.Object` as well as the methods `initMixin` and `destroyMixin` that are supported.
62
- ** Added documentation on touch event handling to `SC.ResponderProtocol` (i.e. the protocol that may be implemented by `SC.Responder` subclasses like `SC.View`).
63
- ** Added/improved documentation on `SC.Gesturable` mixin.
105
+ - Added lots of documentation to `SC.Request` (examples), `SC.Query` (local vs. remote) and `SC.DateTime` (`adjust` and `advance`).
106
+ - Cleaned up documentation of all protocols, including a warning not to mix in protocols and fixed some problems that prevented some protocols from being properly generated on docs.sproutcore.com.
107
+ - Added `SC.ObjectMixinProtocol` with documentation on using mixins with `SC.Object` as well as the methods `initMixin` and `destroyMixin` that are supported.
108
+ - Added documentation on touch event handling to `SC.ResponderProtocol` (i.e. the protocol that may be implemented by `SC.Responder` subclasses like `SC.View`).
109
+ - Added/improved documentation on `SC.Gesturable` mixin.
64
110
 
65
- * SC.PickerPane
111
+ #### SC.PickerPane
66
112
 
67
113
  This view has been given special behavior when used with SC.View's `transitionIn` plugin support. If the plugin defines `layoutProperties` of either `scale` or `rotate`, then the picker will adjust its transform origin X & Y position to appear to scale or rotate out of the anchor. The result is a very nice effect that picker panes appear to pop out of their anchors.
68
114
  To see it in effect, simply set the `transitionIn` property of the pane to one of `SC.View.SCALE_IN` or `SC.View.POP_IN`.
69
115
 
70
- * SC.SegmentedView
116
+ #### SC.SegmentedView
71
117
 
72
118
  This view was refactored slightly to remove the special overflow view if `shouldHandleOverflow` is `false` (default). Previously the overflow view was always created and appended even if it was not to be used.
73
119
 
120
+ #### General
121
+
74
122
  * The automatically adjusted size component of the layouts of `SC.ListView` and `SC.GridView` have changed to set `height` and `width` instead of `minHeight` and `minWidth` (as it applies). The reason for this change is so that the entire list of items can be GPU accelerated by setting `wantsAcceleratedLayer: true` on the view. GPU accelerated positioning using the `translateX` and `translateY` transforms requires that the view have a fixed position (top & left) and a fixed size (height & width). These views already have a fixed position by default and now by having them adjust their `height` or `width` (depending on the direction), it is possible to accelerate these views by also fixing the other size component (i.e. if the list scrolls vertically, the list will set its height, so the developer needs to set the lists width to a fixed value and then add `wantsAcceleratedLayer: true`).
75
123
 
76
124
  Test Results:
@@ -87,6 +135,7 @@ Test Results:
87
135
  Paint x 8: ~6.0ms
88
136
 
89
137
  *How does this affect your code?*
138
+
90
139
  Because lists and grids have an implied layout of `{ top: 0, bottom: 0, left: 0, right: 0 }`, they used to always stretch to fill their parent containing view. This is no longer the case and so a collection with too few items to fill the containing view will only be as tall or as wide as its items warrant. This will affect any background styles that were applied to the collection (such as the Ace theme did), which previously would have covered the whole containing view's background. Unfortunately, those background styles need to be moved to the style of the containing view in order to prevent any styling regressions after updating to this new version.
91
140
 
92
141
  Therefore, to go along with this change the `background: white` style in the Ace theme that was applied to `$theme.collection` has been moved to `$theme.sc-scroll-view`. It has also been changed to `background-color: white`, which is less likely to conflict with other background styles.
@@ -41,6 +41,7 @@ Showcase.mainPage = SC.Page.design({
41
41
  }),
42
42
 
43
43
  detailView: SC.ContainerView.design({
44
+ classNames: ['main-detail-view'],
44
45
  nowShowing: 'Showcase.mainPage.welcomeView',
45
46
  nowShowingBinding: SC.Binding.notEmpty('Showcase.sourceController.view', 'Showcase.mainPage.welcomeView')
46
47
  })
@@ -10,14 +10,20 @@ $theme.sc-source-list.main-source-list {
10
10
  }
11
11
  }
12
12
 
13
- $theme.views-list-view {
13
+ $theme.main-detail-view {
14
14
  @include background-image(linear-gradient(rgba(255,255,255,0.0), rgba(0,0,0,0.2)));
15
15
  background-color: #a1a1a1;
16
+
17
+ .sc-scroll-view {
18
+ @include slice('images/pixels.png', $repeat: repeat);
19
+ background-color: #8fc4f8;
20
+ }
21
+ }
22
+
23
+ $theme.views-list-view {
16
24
  }
17
25
 
18
26
  $theme.views-item-view {
19
- @include slice('images/pixels.png', $repeat: repeat);
20
- background-color: #8fc4f8;
21
27
  border-bottom: 1px solid #5d88b6;
22
28
  border-top: 1px solid #a5d1ff;
23
29
 
@@ -211,7 +217,6 @@ $theme.sc-list-view.my-list-view {
211
217
 
212
218
 
213
219
  $theme.sc-scroll-view.my-scroll-view {
214
- background-color: #ececec;
215
220
  border: 1px solid #7f7f7f;
216
221
  }
217
222
 
@@ -31,6 +31,6 @@ SC.Pane.reopen(
31
31
  @returns {void}
32
32
  */
33
33
  removeFromParent: function() {
34
- throw SC.Error.desc("SC.Pane cannot be removed from its parent, since it's the root. Did you mean remove()?");
34
+ SC.throw("SC.Pane cannot be removed from its parent, since it's the root. Did you mean remove()?");
35
35
  }
36
36
  });
@@ -253,16 +253,6 @@ SC.mixin(SC.Event, /** @scope SC.Event */ {
253
253
  // don't do events on text and comment nodes
254
254
  if ( elem.nodeType === 3 || elem.nodeType === 8 ) return SC.Event;
255
255
 
256
- /*
257
- commenting out this block because
258
- 1. this issue is no longer reproducible in IE7, 8 or 9
259
- 2. this causes undesired behavior if one tries to remove an event from
260
- an iframe because elem.setInterval is true there.
261
- */
262
- // // For whatever reason, IE has trouble passing the window object
263
- // // around, causing it to be cloned in the process
264
- // if (SC.browser.name === SC.BROWSER.ie && elem.setInterval) elem = window;
265
-
266
256
  var handlers, key, events = SC.data(elem, "sc_events") ;
267
257
  if (!events) return this ; // nothing to do if no events are registered
268
258
 
@@ -75,7 +75,7 @@ SC.Locale = SC.Object.extend({
75
75
  /**
76
76
  The inflection constants for this locale.
77
77
  */
78
- inflectionConstants: {},
78
+ inflectionConstants: null,
79
79
 
80
80
  /**
81
81
  The method used to compute the ordinal of a number for this locale.
@@ -1094,10 +1094,9 @@ SC.RootResponder = SC.Object.extend(
1094
1094
  averaged.d = 0;
1095
1095
  averaged.velocityX = 0;
1096
1096
  averaged.velocityY = 0;
1097
- averaged.touchCount = 0;
1098
- }
1097
+
1099
1098
  // Otherwise, average the touches.
1100
- else {
1099
+ } else {
1101
1100
  // Cache the array object used by this method. (Cleared at the end to prevent memory leaks.)
1102
1101
  var touches = this._averagedTouches_touches || (this._averagedTouches_touches = []);
1103
1102
 
@@ -1114,47 +1113,8 @@ SC.RootResponder = SC.Object.extend(
1114
1113
  // Add additionalTouch if present and not duplicated.
1115
1114
  if (additionalTouch && !additionalTouchIsDuplicate) touches.push(additionalTouch);
1116
1115
 
1117
- // prepare variables for looping
1118
- var idx, touch,
1119
- ax = 0, ay = 0, dx, dy, ad = 0, avx = 0, avy = 0;
1120
- len = touches.length;
1121
-
1122
- // first, add
1123
- for (idx = 0; idx < len; idx++) {
1124
- touch = touches[idx];
1125
- ax += touch.pageX;
1126
- ay += touch.pageY;
1127
- avx += touch.velocityX;
1128
- avy += touch.velocityY;
1129
- }
1130
-
1131
- // now, average
1132
- ax /= len;
1133
- ay /= len;
1134
- avx /= len;
1135
- avy /= len;
1136
-
1137
- // distance
1138
- for (idx = 0; idx < len; idx++) {
1139
- touch = touches[idx];
1140
-
1141
- // get distance from average
1142
- dx = Math.abs(touch.pageX - ax);
1143
- dy = Math.abs(touch.pageY - ay);
1144
-
1145
- // Pythagoras was clever...
1146
- ad += Math.pow(dx * dx + dy * dy, 0.5);
1147
- }
1148
-
1149
- // average
1150
- ad /= len;
1151
-
1152
- averaged.x = ax;
1153
- averaged.y = ay;
1154
- averaged.velocityX = avx;
1155
- averaged.velocityY = avy;
1156
- averaged.d = ad;
1157
- averaged.touchCount = len;
1116
+ // Calculate the average.
1117
+ SC.Touch.averagedTouch(touches, averaged);
1158
1118
 
1159
1119
  // Clear the touches array to prevent touch object leaks.
1160
1120
  touches.length = 0;
@@ -2159,7 +2119,6 @@ SC.RootResponder = SC.Object.extend(
2159
2119
  dragView.tryToPerform('mouseUp', evt);
2160
2120
  });
2161
2121
  } else {
2162
-
2163
2122
  var view = this._mouseDownView,
2164
2123
  targetView = this.targetViewForEvent(evt);
2165
2124
 
@@ -2342,6 +2301,7 @@ SC.RootResponder = SC.Object.extend(
2342
2301
  dragenter: function(evt) {
2343
2302
  SC.run(function() { this._dragenter(evt); }, this);
2344
2303
  },
2304
+
2345
2305
  /** @private */
2346
2306
  _dragenter: function(evt) {
2347
2307
  if (!this._dragCounter) {
@@ -2350,10 +2310,12 @@ SC.RootResponder = SC.Object.extend(
2350
2310
  else this._dragCounter++;
2351
2311
  return this._dragover(evt);
2352
2312
  },
2313
+
2353
2314
  /** @private The dragleave event comes from the browser when a data-ful drag leaves any element. */
2354
2315
  dragleave: function(evt) {
2355
2316
  SC.run(function() { this._dragleave(evt); }, this);
2356
2317
  },
2318
+
2357
2319
  /** @private */
2358
2320
  _dragleave: function(evt) {
2359
2321
  this._dragCounter--;
@@ -2373,10 +2335,12 @@ SC.RootResponder = SC.Object.extend(
2373
2335
  this._dragover(evt);
2374
2336
  });
2375
2337
  },
2338
+
2376
2339
  /** @private This event fires continuously while the dataful drag is over the document. */
2377
2340
  dragover: function(evt) {
2378
2341
  SC.run(function() { this._dragover(evt); }, this);
2379
2342
  },
2343
+
2380
2344
  /** @private */
2381
2345
  _dragover: function(evt) {
2382
2346
  // If it's a file being dragged, prevent the default (leaving the app and opening the file).
@@ -2447,6 +2411,7 @@ SC.RootResponder = SC.Object.extend(
2447
2411
  drop: function(evt) {
2448
2412
  SC.run(function() { this._drop(evt); }, this);
2449
2413
  },
2414
+
2450
2415
  /** @private */
2451
2416
  _drop: function(evt) {
2452
2417
  // If it's a file being dragged, prevent the default (leaving the app and opening the file).
@@ -158,7 +158,7 @@ SC.SelectionSet = SC.Object.extend(SC.Enumerable, SC.Freezable, SC.Copyable,
158
158
  */
159
159
  add: function(source, start, length) {
160
160
 
161
- if (this.isFrozen) throw SC.FROZEN_ERROR ;
161
+ if (this.isFrozen) throw new Error(SC.FROZEN_ERROR);
162
162
 
163
163
  var sets, len, idx, set, oldlen, newlen, setlen, objects;
164
164
 
@@ -218,7 +218,7 @@ SC.SelectionSet = SC.Object.extend(SC.Enumerable, SC.Freezable, SC.Copyable,
218
218
  */
219
219
  remove: function(source, start, length) {
220
220
 
221
- if (this.isFrozen) throw SC.FROZEN_ERROR ;
221
+ if (this.isFrozen) throw new Error(SC.FROZEN_ERROR);
222
222
 
223
223
  var sets, len, idx, i, set, oldlen, newlen, setlen, objects, object;
224
224
 
@@ -536,7 +536,7 @@ SC.SelectionSet = SC.Object.extend(SC.Enumerable, SC.Freezable, SC.Copyable,
536
536
  @returns {SC.SelectionSet}
537
537
  */
538
538
  clear: function() {
539
- if (this.isFrozen) throw SC.FROZEN_ERROR;
539
+ if (this.isFrozen) throw new Error(SC.FROZEN_ERROR);
540
540
  if (this._sets) this._sets.length = 0 ; // truncate
541
541
  if (this._objects) this._objects = null;
542
542
 
@@ -143,6 +143,13 @@ SC.Touch = function(touch, touchContext) {
143
143
  };
144
144
 
145
145
  SC.Touch.prototype = {
146
+ //@if(debug)
147
+ // Debug-mode only.
148
+ toString: function () {
149
+ return "SC.Touch (%@)".fmt(this.identifier);
150
+ },
151
+ //@endif
152
+
146
153
  /**@scope SC.Touch.prototype*/
147
154
 
148
155
  /** @private
@@ -532,7 +539,76 @@ SC.Touch.prototype = {
532
539
  };
533
540
 
534
541
  SC.mixin(SC.Touch, {
542
+
535
543
  create: function(touch, touchContext) {
536
544
  return new SC.Touch(touch, touchContext);
545
+ },
546
+
547
+ /**
548
+ Returns the averaged touch for an array of given touches. The averaged touch includes the
549
+ average position of all the touches (i.e. the center point), the averaged distance of all
550
+ the touches (i.e. the average of each touch's distance to the center) and the average velocity
551
+ of each touch.
552
+
553
+ The returned Object has a signature like,
554
+
555
+ {
556
+ x: ...,
557
+ y: ...,
558
+ velocityX: ...,
559
+ velocityY: ...,
560
+ d: ...
561
+ }
562
+
563
+ @param {Array} touches An array of touches to average.
564
+ @param {Object} objectRef An Object to assign the values to rather than creating a new Object. If you pass an Object to this method, that same Object will be returned with the values assigned to it. This is useful in order to only alloc memory once and hold it in order to avoid garbage collection. The trade-off is that more memory remains in use indefinitely.
565
+ @returns {Object} The averaged touch.
566
+ */
567
+ averagedTouch: function (touches, objectRef) {
568
+ var len = touches.length,
569
+ ax = 0, ay = 0, avx = 0, avy = 0,
570
+ idx, touch;
571
+
572
+ // If no holder object is given, create a new one.
573
+ if (objectRef === undefined) { objectRef = {}; }
574
+
575
+ // Sum the positions and velocities of each touch.
576
+ for (idx = 0; idx < len; idx++) {
577
+ touch = touches[idx];
578
+ ax += touch.pageX;
579
+ ay += touch.pageY;
580
+ avx += touch.velocityX;
581
+ avy += touch.velocityY;
582
+ }
583
+
584
+ // Average each value.
585
+ ax /= len;
586
+ ay /= len;
587
+ avx /= len;
588
+ avy /= len;
589
+
590
+ // Calculate average distance.
591
+ var ad = 0;
592
+ for (idx = 0; idx < len; idx++) {
593
+ touch = touches[idx];
594
+
595
+ // Get distance for each from average position.
596
+ var dx = Math.abs(touch.pageX - ax);
597
+ var dy = Math.abs(touch.pageY - ay);
598
+
599
+ // Pythagoras was clever...
600
+ ad += Math.pow(dx * dx + dy * dy, 0.5);
601
+ }
602
+
603
+ // Average value.
604
+ ad /= len;
605
+
606
+ objectRef.x = ax;
607
+ objectRef.y = ay;
608
+ objectRef.velocityX = avx;
609
+ objectRef.velocityY = avy;
610
+ objectRef.d = ad;
611
+
612
+ return objectRef;
537
613
  }
538
614
  });