sproutcore 1.5.0.rc.1 → 1.5.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -17,15 +17,13 @@
|
|
17
17
|
You can either create a subclass of ScrollerView with the new values, or
|
18
18
|
provide your own in your theme:
|
19
19
|
|
20
|
-
{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
});
|
28
|
-
}}}
|
20
|
+
SC.mixin(SC.ScrollerView.prototype, {
|
21
|
+
scrollbarThickness: 14,
|
22
|
+
capLength: 18,
|
23
|
+
capOverlap: 14,
|
24
|
+
buttonOverlap: 11,
|
25
|
+
buttonLength: 41
|
26
|
+
});
|
29
27
|
|
30
28
|
You can change whether scroll buttons are displayed by setting the
|
31
29
|
hasButtons property.
|
@@ -36,15 +34,30 @@
|
|
36
34
|
SC.ScrollerView = SC.View.extend(
|
37
35
|
/** @scope SC.ScrollerView.prototype */ {
|
38
36
|
|
37
|
+
/**
|
38
|
+
@type Array
|
39
|
+
@default ['sc-scroller-view']
|
40
|
+
@see SC.View#classNames
|
41
|
+
*/
|
39
42
|
classNames: ['sc-scroller-view'],
|
40
43
|
|
41
44
|
/**
|
42
|
-
|
43
|
-
|
45
|
+
@type Array
|
46
|
+
@default 'thumbPosition thumbLength isEnabled controlsHidden'.w()
|
47
|
+
@see SC.View#displayProperties
|
48
|
+
*/
|
49
|
+
displayProperties: 'thumbPosition thumbLength isEnabled controlsHidden'.w(),
|
50
|
+
|
51
|
+
/**
|
52
|
+
The WAI-ARIA role for scroller view.
|
44
53
|
|
45
|
-
@
|
54
|
+
@type String
|
55
|
+
@default 'scrollbar'
|
56
|
+
@readOnly
|
46
57
|
*/
|
47
58
|
ariaRole: 'scrollbar',
|
59
|
+
|
60
|
+
|
48
61
|
// ..........................................................
|
49
62
|
// PROPERTIES
|
50
63
|
//
|
@@ -54,12 +67,14 @@ SC.ScrollerView = SC.View.extend(
|
|
54
67
|
Otherwise, a click on the track will cause a page down.
|
55
68
|
|
56
69
|
In either case, alt-clicks will perform the opposite behavior.
|
70
|
+
|
71
|
+
@type Boolean
|
72
|
+
@default NO
|
57
73
|
*/
|
58
74
|
shouldScrollToClick: NO,
|
59
75
|
|
60
76
|
|
61
|
-
/**
|
62
|
-
@private
|
77
|
+
/** @private
|
63
78
|
The in-touch-scroll value.
|
64
79
|
*/
|
65
80
|
_touchScrollValue: NO,
|
@@ -68,8 +83,11 @@ SC.ScrollerView = SC.View.extend(
|
|
68
83
|
The value of the scroller.
|
69
84
|
|
70
85
|
The value represents the position of the scroller's thumb.
|
71
|
-
|
72
|
-
@
|
86
|
+
|
87
|
+
@field
|
88
|
+
@type Number
|
89
|
+
@observes maximum
|
90
|
+
@observes minimum
|
73
91
|
*/
|
74
92
|
value: function(key, val) {
|
75
93
|
var minimum = this.get('minimum');
|
@@ -81,6 +99,10 @@ SC.ScrollerView = SC.View.extend(
|
|
81
99
|
return Math.max(Math.min(val, this.get('maximum')), minimum) ;
|
82
100
|
}.property('maximum', 'minimum').cacheable(),
|
83
101
|
|
102
|
+
/**
|
103
|
+
@type Number
|
104
|
+
@observes value
|
105
|
+
*/
|
84
106
|
displayValue: function() {
|
85
107
|
var ret;
|
86
108
|
if (this.get("_touchScrollValue")) ret = this.get("_touchScrollValue");
|
@@ -97,7 +119,8 @@ SC.ScrollerView = SC.View.extend(
|
|
97
119
|
the slot). Note that if the proportion is 1.0 then the control will be
|
98
120
|
disabled.
|
99
121
|
|
100
|
-
@
|
122
|
+
@type Number
|
123
|
+
@default 0.0
|
101
124
|
*/
|
102
125
|
proportion: 0,
|
103
126
|
|
@@ -107,7 +130,8 @@ SC.ScrollerView = SC.View.extend(
|
|
107
130
|
|
108
131
|
When set less than the height of the scroller, the scroller is disabled.
|
109
132
|
|
110
|
-
@
|
133
|
+
@type Number
|
134
|
+
@default 100
|
111
135
|
*/
|
112
136
|
maximum: 100,
|
113
137
|
|
@@ -115,7 +139,8 @@ SC.ScrollerView = SC.View.extend(
|
|
115
139
|
The minimum offset value for the scroller. This will be used to calculate
|
116
140
|
the internal height/width of the scroller itself.
|
117
141
|
|
118
|
-
@
|
142
|
+
@type Number
|
143
|
+
@default 0
|
119
144
|
*/
|
120
145
|
minimum: 0,
|
121
146
|
|
@@ -123,7 +148,10 @@ SC.ScrollerView = SC.View.extend(
|
|
123
148
|
YES to enable scrollbar, NO to disable it. Scrollbars will automatically
|
124
149
|
disable if the maximum scroll width does not exceed their capacity.
|
125
150
|
|
126
|
-
@
|
151
|
+
@field
|
152
|
+
@type Boolean
|
153
|
+
@default YES
|
154
|
+
@observes proportion
|
127
155
|
*/
|
128
156
|
isEnabled: function(key, value) {
|
129
157
|
if (value !== undefined) {
|
@@ -137,26 +165,32 @@ SC.ScrollerView = SC.View.extend(
|
|
137
165
|
return this.get('proportion') < 1;
|
138
166
|
}.property('proportion').cacheable(),
|
139
167
|
|
140
|
-
|
168
|
+
/** @private */
|
141
169
|
_scsv_isEnabled: undefined,
|
142
170
|
|
143
171
|
/**
|
144
172
|
Determine the layout direction. Determines whether the scrollbar should
|
145
173
|
appear horizontal or vertical. This must be set when the view is created.
|
146
|
-
Changing this once the view has been created will have no effect.
|
174
|
+
Changing this once the view has been created will have no effect. Possible
|
175
|
+
values:
|
176
|
+
|
177
|
+
- SC.LAYOUT_VERTICAL
|
178
|
+
- SC.LAYOUT_HORIZONTAL
|
147
179
|
|
148
|
-
@
|
180
|
+
@type String
|
181
|
+
@default SC.LAYOUT_VERTICAL
|
149
182
|
*/
|
150
183
|
layoutDirection: SC.LAYOUT_VERTICAL,
|
151
184
|
|
152
185
|
/**
|
153
186
|
Whether or not the scroller should display scroll buttons
|
154
187
|
|
155
|
-
@
|
188
|
+
@type Boolean
|
156
189
|
@default YES
|
157
190
|
*/
|
158
191
|
hasButtons: YES,
|
159
192
|
|
193
|
+
|
160
194
|
// ..........................................................
|
161
195
|
// DISPLAY METRICS
|
162
196
|
//
|
@@ -165,21 +199,24 @@ SC.ScrollerView = SC.View.extend(
|
|
165
199
|
The width (if vertical scroller) or height (if horizontal scroller) of the
|
166
200
|
scrollbar.
|
167
201
|
|
168
|
-
@
|
202
|
+
@type Number
|
203
|
+
@default 14
|
169
204
|
*/
|
170
205
|
scrollbarThickness: 14,
|
171
206
|
|
172
207
|
/**
|
173
208
|
The width or height of the cap that encloses the track.
|
174
209
|
|
175
|
-
@
|
210
|
+
@type Number
|
211
|
+
@default 18
|
176
212
|
*/
|
177
213
|
capLength: 18,
|
178
214
|
|
179
215
|
/**
|
180
216
|
The amount by which the thumb overlaps the cap.
|
181
217
|
|
182
|
-
@
|
218
|
+
@type Number
|
219
|
+
@default 14
|
183
220
|
*/
|
184
221
|
capOverlap: 14,
|
185
222
|
|
@@ -188,7 +225,8 @@ SC.ScrollerView = SC.View.extend(
|
|
188
225
|
scroller is not displaying arrows, this is the width or height of the end
|
189
226
|
cap.
|
190
227
|
|
191
|
-
@
|
228
|
+
@type Number
|
229
|
+
@defaut 41
|
192
230
|
*/
|
193
231
|
buttonLength: 41,
|
194
232
|
|
@@ -197,7 +235,8 @@ SC.ScrollerView = SC.View.extend(
|
|
197
235
|
is not displaying arrows, this is the amount by which the thumb overlaps
|
198
236
|
the end cap.
|
199
237
|
|
200
|
-
@
|
238
|
+
@type Number
|
239
|
+
@default 11
|
201
240
|
*/
|
202
241
|
buttonOverlap: 11,
|
203
242
|
|
@@ -205,7 +244,8 @@ SC.ScrollerView = SC.View.extend(
|
|
205
244
|
The minimium length that the thumb will be, regardless of how much content
|
206
245
|
is in the scroll view.
|
207
246
|
|
208
|
-
@
|
247
|
+
@type Number
|
248
|
+
@default 20
|
209
249
|
*/
|
210
250
|
minimumThumbLength: 20,
|
211
251
|
|
@@ -213,9 +253,8 @@ SC.ScrollerView = SC.View.extend(
|
|
213
253
|
// INTERNAL SUPPORT
|
214
254
|
//
|
215
255
|
|
216
|
-
displayProperties: 'thumbPosition thumbLength isEnabled controlsHidden'.w(),
|
217
256
|
|
218
|
-
/**
|
257
|
+
/** @private
|
219
258
|
Generates the HTML that gets displayed to the user.
|
220
259
|
|
221
260
|
The first time render is called, the HTML will be output to the DOM.
|
@@ -313,17 +352,17 @@ SC.ScrollerView = SC.View.extend(
|
|
313
352
|
}
|
314
353
|
},
|
315
354
|
|
316
|
-
/**
|
317
|
-
@private
|
318
|
-
*/
|
355
|
+
/** @private */
|
319
356
|
touchScrollDidStart: function(value) {
|
320
357
|
this.set("_touchScrollValue", value);
|
321
358
|
},
|
322
359
|
|
360
|
+
/** @private */
|
323
361
|
touchScrollDidEnd: function(value) {
|
324
362
|
this.set("_touchScrollValue", NO);
|
325
363
|
},
|
326
364
|
|
365
|
+
/** @private */
|
327
366
|
touchScrollDidChange: function(value) {
|
328
367
|
this.set("_touchScrollValue", value);
|
329
368
|
},
|
@@ -331,7 +370,8 @@ SC.ScrollerView = SC.View.extend(
|
|
331
370
|
// ..........................................................
|
332
371
|
// THUMB MANAGEMENT
|
333
372
|
//
|
334
|
-
|
373
|
+
|
374
|
+
/** @private
|
335
375
|
Adjusts the thumb (for backwards-compatibility calls adjustThumbPosition+adjustThumbSize by default)
|
336
376
|
*/
|
337
377
|
adjustThumb: function(thumb, position, length) {
|
@@ -339,11 +379,10 @@ SC.ScrollerView = SC.View.extend(
|
|
339
379
|
this.adjustThumbSize(thumb, length);
|
340
380
|
},
|
341
381
|
|
342
|
-
/**
|
382
|
+
/** @private
|
343
383
|
Updates the position of the thumb DOM element.
|
344
384
|
|
345
385
|
@param {Number} position the position of the thumb in pixels
|
346
|
-
@private
|
347
386
|
*/
|
348
387
|
adjustThumbPosition: function(thumb, position) {
|
349
388
|
// Don't touch the DOM if the position hasn't changed
|
@@ -361,6 +400,7 @@ SC.ScrollerView = SC.View.extend(
|
|
361
400
|
this._thumbPosition = position;
|
362
401
|
},
|
363
402
|
|
403
|
+
/** @private */
|
364
404
|
adjustThumbSize: function(thumb, size) {
|
365
405
|
// Don't touch the DOM if the size hasn't changed
|
366
406
|
if (this._thumbSize === size) return;
|
@@ -381,7 +421,7 @@ SC.ScrollerView = SC.View.extend(
|
|
381
421
|
// SCROLLER DIMENSION COMPUTED PROPERTIES
|
382
422
|
//
|
383
423
|
|
384
|
-
/**
|
424
|
+
/** @private
|
385
425
|
Returns the total length of the track in which the thumb sits.
|
386
426
|
|
387
427
|
The length of the track is the height or width of the scroller, less the
|
@@ -389,7 +429,6 @@ SC.ScrollerView = SC.View.extend(
|
|
389
429
|
position of the thumb relative to the view.
|
390
430
|
|
391
431
|
@property
|
392
|
-
@private
|
393
432
|
*/
|
394
433
|
trackLength: function() {
|
395
434
|
var scrollerLength = this.get('scrollerLength');
|
@@ -403,13 +442,12 @@ SC.ScrollerView = SC.View.extend(
|
|
403
442
|
return scrollerLength;
|
404
443
|
}.property('scrollerLength').cacheable(),
|
405
444
|
|
406
|
-
/**
|
445
|
+
/** @private
|
407
446
|
Returns the height of the view if this is a vertical scroller or the width
|
408
447
|
of the view if this is a horizontal scroller. This is used when scrolling
|
409
448
|
up and down by page, as well as in various layout calculations.
|
410
449
|
|
411
|
-
@
|
412
|
-
@private
|
450
|
+
@type Number
|
413
451
|
*/
|
414
452
|
scrollerLength: function() {
|
415
453
|
switch (this.get('layoutDirection')) {
|
@@ -422,12 +460,11 @@ SC.ScrollerView = SC.View.extend(
|
|
422
460
|
return 0;
|
423
461
|
}.property('frame').cacheable(),
|
424
462
|
|
425
|
-
/**
|
463
|
+
/** @private
|
426
464
|
The total length of the thumb. The size of the thumb is the
|
427
465
|
length of the track times the content proportion.
|
428
466
|
|
429
467
|
@property
|
430
|
-
@private
|
431
468
|
*/
|
432
469
|
thumbLength: function() {
|
433
470
|
var length;
|
@@ -438,12 +475,11 @@ SC.ScrollerView = SC.View.extend(
|
|
438
475
|
return Math.max(length, this.get('minimumThumbLength'));
|
439
476
|
}.property('trackLength', 'proportion').cacheable(),
|
440
477
|
|
441
|
-
/**
|
478
|
+
/** @private
|
442
479
|
The position of the thumb in the track.
|
443
480
|
|
444
|
-
@
|
481
|
+
@type Number
|
445
482
|
@isReadOnly
|
446
|
-
@private
|
447
483
|
*/
|
448
484
|
thumbPosition: function() {
|
449
485
|
var value = this.get('displayValue'),
|
@@ -459,26 +495,24 @@ SC.ScrollerView = SC.View.extend(
|
|
459
495
|
return Math.floor(isNaN(position) ? 0 : position);
|
460
496
|
}.property('displayValue', 'maximum', 'trackLength', 'thumbLength').cacheable(),
|
461
497
|
|
462
|
-
/**
|
498
|
+
/** @private
|
463
499
|
YES if the maximum value exceeds the frame size of the scroller. This
|
464
500
|
will hide the thumb and buttons.
|
465
501
|
|
466
|
-
@
|
502
|
+
@type Boolean
|
467
503
|
@isReadOnly
|
468
|
-
@private
|
469
504
|
*/
|
470
505
|
controlsHidden: function() {
|
471
506
|
return this.get('proportion') >= 1;
|
472
507
|
}.property('proportion').cacheable(),
|
473
508
|
|
509
|
+
|
474
510
|
// ..........................................................
|
475
511
|
// MOUSE EVENTS
|
476
512
|
//
|
477
513
|
|
478
|
-
/**
|
514
|
+
/** @private
|
479
515
|
Returns the value for a position within the scroller's frame.
|
480
|
-
|
481
|
-
@private
|
482
516
|
*/
|
483
517
|
valueForPosition: function(pos) {
|
484
518
|
var max = this.get('maximum'),
|
@@ -493,7 +527,7 @@ SC.ScrollerView = SC.View.extend(
|
|
493
527
|
return value;
|
494
528
|
},
|
495
529
|
|
496
|
-
/**
|
530
|
+
/** @private
|
497
531
|
Handles mouse down events and adjusts the value property depending where
|
498
532
|
the user clicked.
|
499
533
|
|
@@ -512,7 +546,6 @@ SC.ScrollerView = SC.View.extend(
|
|
512
546
|
are repeated until they release the mouse button.
|
513
547
|
|
514
548
|
@param evt {SC.Event} the mousedown event
|
515
|
-
@private
|
516
549
|
*/
|
517
550
|
mouseDown: function(evt) {
|
518
551
|
if (!this.get('isEnabled')) return NO;
|
@@ -604,13 +637,12 @@ SC.ScrollerView = SC.View.extend(
|
|
604
637
|
return YES;
|
605
638
|
},
|
606
639
|
|
607
|
-
/**
|
640
|
+
/** @private
|
608
641
|
When the user releases the mouse button, remove any active
|
609
642
|
state from the button controls, and cancel any outstanding
|
610
643
|
timers.
|
611
644
|
|
612
645
|
@param evt {SC.Event} the mousedown event
|
613
|
-
@private
|
614
646
|
*/
|
615
647
|
mouseUp: function(evt) {
|
616
648
|
var active = this._scs_buttonActive, ret = NO, timer;
|
@@ -636,7 +668,7 @@ SC.ScrollerView = SC.View.extend(
|
|
636
668
|
return ret;
|
637
669
|
},
|
638
670
|
|
639
|
-
/**
|
671
|
+
/** @private
|
640
672
|
If the user began the drag on the thumb, we calculate the difference
|
641
673
|
between the mouse position at click and where it is now. We then
|
642
674
|
offset the thumb by that amount, within the bounds of the track.
|
@@ -645,7 +677,6 @@ SC.ScrollerView = SC.View.extend(
|
|
645
677
|
what component they are currently over, changing the scroll direction.
|
646
678
|
|
647
679
|
@param evt {SC.Event} the mousedragged event
|
648
|
-
@private
|
649
680
|
*/
|
650
681
|
mouseDragged: function(evt) {
|
651
682
|
var value, length, delta, thumbPosition,
|
@@ -736,15 +767,13 @@ SC.ScrollerView = SC.View.extend(
|
|
736
767
|
return YES;
|
737
768
|
},
|
738
769
|
|
739
|
-
/**
|
770
|
+
/** @private
|
740
771
|
Starts a timer that fires after 300ms. This is called when the user
|
741
772
|
clicks a button or inside the track to move a page at a time. If they
|
742
773
|
continue holding the mouse button down, we want to repeat that action
|
743
774
|
after a small delay. This timer will be invalidated in mouseUp.
|
744
775
|
|
745
776
|
Specify "immediate" as YES if it should not wait.
|
746
|
-
|
747
|
-
@private
|
748
777
|
*/
|
749
778
|
startMouseDownTimer: function(action, immediate) {
|
750
779
|
var timer;
|
@@ -755,11 +784,9 @@ SC.ScrollerView = SC.View.extend(
|
|
755
784
|
});
|
756
785
|
},
|
757
786
|
|
758
|
-
/**
|
787
|
+
/** @private
|
759
788
|
Called by the mousedown timer. This method determines the initial
|
760
789
|
user action and repeats it until the timer is invalidated in mouseUp.
|
761
|
-
|
762
|
-
@private
|
763
790
|
*/
|
764
791
|
mouseDownTimerDidFire: function() {
|
765
792
|
var scrollerLength = this.get('scrollerLength'),
|
@@ -798,13 +825,12 @@ SC.ScrollerView = SC.View.extend(
|
|
798
825
|
});
|
799
826
|
},
|
800
827
|
|
801
|
-
/**
|
828
|
+
/** @private
|
802
829
|
Given a selector, finds the corresponding DOM element and adds
|
803
830
|
the 'active' class name. Also stores the returned element so that
|
804
831
|
the 'active' class name can be removed during mouseup.
|
805
832
|
|
806
833
|
@param {String} the selector to find
|
807
|
-
@private
|
808
834
|
*/
|
809
835
|
makeButtonActive: function(selector) {
|
810
836
|
this._scs_buttonActive = this.$(selector).addClass('active');
|
@@ -812,14 +838,52 @@ SC.ScrollerView = SC.View.extend(
|
|
812
838
|
});
|
813
839
|
|
814
840
|
// TODO: Use render delegates to handle rendering.
|
815
|
-
|
841
|
+
|
842
|
+
/**
|
843
|
+
@class
|
844
|
+
@extends SC.ScrollerView
|
845
|
+
*/
|
846
|
+
SC.TouchScrollerView = SC.ScrollerView.extend(
|
847
|
+
/** @scope SC.TouchScrollerView.prototype */{
|
848
|
+
|
849
|
+
/**
|
850
|
+
@type Array
|
851
|
+
@default ['sc-touch-scroller-view']
|
852
|
+
@see SC.View#classNames
|
853
|
+
*/
|
816
854
|
classNames: ['sc-touch-scroller-view'],
|
855
|
+
|
856
|
+
/**
|
857
|
+
@type Number
|
858
|
+
@default 12
|
859
|
+
*/
|
817
860
|
scrollbarThickness: 12,
|
861
|
+
|
862
|
+
/**
|
863
|
+
@type Number
|
864
|
+
@default 5
|
865
|
+
*/
|
818
866
|
capLength: 5,
|
867
|
+
|
868
|
+
/**
|
869
|
+
@type Number
|
870
|
+
@default 0
|
871
|
+
*/
|
819
872
|
capOverlap: 0,
|
873
|
+
|
874
|
+
/**
|
875
|
+
@type Boolean
|
876
|
+
@default NO
|
877
|
+
*/
|
820
878
|
hasButtons: NO,
|
879
|
+
|
880
|
+
/**
|
881
|
+
@type Number
|
882
|
+
@default 36
|
883
|
+
*/
|
821
884
|
buttonOverlap: 36,
|
822
885
|
|
886
|
+
/** @private */
|
823
887
|
adjustThumb: function(thumb, position, length) {
|
824
888
|
var thumbInner = this.$('.thumb-inner');
|
825
889
|
var max = this.get("scrollerLength") - this.capLength, min = this.get("minimum") + this.capLength;
|
@@ -853,6 +917,7 @@ SC.TouchScrollerView = SC.ScrollerView.extend({
|
|
853
917
|
this._thumbSize = length;
|
854
918
|
},
|
855
919
|
|
920
|
+
/** @private */
|
856
921
|
render: function(context, firstTime) {
|
857
922
|
var classNames = [],
|
858
923
|
buttons = '',
|