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.
- checksums.yaml +8 -8
- data/CHANGELOG +10 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +114 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +1 -7
- data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +167 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +24 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/stack_layout.js +737 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +0 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +11 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/{desktop/protocols/responder.js → core_foundation/protocols/responder_protocol.js} +83 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/{sparse_array_delegate.js → sparse_array_delegate_protocol.js} +11 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +11 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +0 -22
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +61 -56
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +63 -39
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +28 -28
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +10 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +102 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +103 -103
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/replaceAllChildren_test.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +77 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +18 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +42 -49
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +16 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +241 -102
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +993 -610
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +6 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +94 -27
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +133 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +30 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +73 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/conflictedStoreKeys_test.js +156 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +61 -37
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +68 -39
- data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +8 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +80 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_data_source.js → drag_data_source_protocol.js} +16 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_source.js → drag_source_protocol.js} +28 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drop_target.js → drop_target_protocol.js} +73 -75
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +39 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +120 -97
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowSizeForContentIndex.js +26 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/{dividers.js → dividers_test.js} +38 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +29 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +13 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +41 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +41 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -12
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +14 -10
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +104 -63
- data/lib/frameworks/sproutcore/frameworks/foundation/protocols/swap_transition_protocol.js +9 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +33 -33
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/transitions/view_transitions_test.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +0 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +0 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +12 -8
- data/lib/frameworks/sproutcore/frameworks/media/resources/silence.mp3 +0 -0
- data/lib/frameworks/sproutcore/frameworks/media/tests/audio.js +69 -0
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +11 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/protocols/mixin_protocol.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +447 -137
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +9 -15
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +19 -17
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +188 -16
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/panes/template.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/panes/template.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +43 -26
- data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +9 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +0 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/scroll/scroll.css +3 -0
- data/sproutcore.gemspec +3 -3
- metadata +19 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +0 -465
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +0 -472
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js +0 -87
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +0 -89
@@ -333,36 +333,40 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
333
333
|
init: function () {
|
334
334
|
sc_super();
|
335
335
|
|
336
|
-
|
337
|
-
|
338
|
-
icon = this.get('overflowIcon'),
|
339
|
-
overflowView;
|
340
|
-
|
341
|
-
overflowView = this.get('segmentViewClass').create({
|
342
|
-
controlSize: this.get('controlSize'),
|
343
|
-
escapeHTML: false,
|
344
|
-
localize: this.get('localize'),
|
345
|
-
title: title,
|
346
|
-
toolTip: toolTip,
|
347
|
-
icon: icon,
|
348
|
-
isLastSegment: YES,
|
349
|
-
isOverflowSegment: YES,
|
350
|
-
layoutDirection: this.get('layoutDirection'),
|
351
|
-
isVisible: this.get('shouldHandleOverflow')
|
352
|
-
});
|
353
|
-
this.set('overflowView', overflowView);
|
354
|
-
|
355
|
-
this.appendChild(overflowView);
|
356
|
-
|
336
|
+
// Initialize.
|
337
|
+
this.shouldHandleOverflowDidChange();
|
357
338
|
this.itemsDidChange();
|
358
339
|
},
|
359
340
|
|
360
341
|
shouldHandleOverflowDidChange: function () {
|
342
|
+
var overflowView = this.get('overflowView');
|
343
|
+
|
361
344
|
if (this.get('shouldHandleOverflow')) {
|
345
|
+
var title = this.get('overflowTitle'),
|
346
|
+
toolTip = this.get('overflowToolTip'),
|
347
|
+
icon = this.get('overflowIcon');
|
348
|
+
|
349
|
+
overflowView = this.get('segmentViewClass').create({
|
350
|
+
controlSize: this.get('controlSize'),
|
351
|
+
escapeHTML: false,
|
352
|
+
localize: this.get('localize'),
|
353
|
+
title: title,
|
354
|
+
toolTip: toolTip,
|
355
|
+
icon: icon,
|
356
|
+
isLastSegment: YES,
|
357
|
+
isOverflowSegment: YES,
|
358
|
+
layoutDirection: this.get('layoutDirection')
|
359
|
+
});
|
360
|
+
this.appendChild(overflowView);
|
361
|
+
this.set('overflowView', overflowView);
|
362
|
+
|
362
363
|
// remeasure should show/hide it as needed
|
363
364
|
this.invokeLast(this.remeasure);
|
364
365
|
} else {
|
365
|
-
|
366
|
+
if (overflowView) { // There will not be an overflow view on initialization.
|
367
|
+
this.removeChildAndDestroy(overflowView);
|
368
|
+
this.set('overflowView', null);
|
369
|
+
}
|
366
370
|
}
|
367
371
|
}.observes('shouldHandleOverflow'),
|
368
372
|
|
@@ -385,10 +389,11 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
385
389
|
i, j;
|
386
390
|
|
387
391
|
// Update childViews
|
388
|
-
|
392
|
+
var childViewsLength = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : childViews.get('length');
|
393
|
+
if (childViewsLength > items.get('length')) { // We've lost segments (ie. childViews)
|
389
394
|
|
390
395
|
// Remove unneeded segments from the end back
|
391
|
-
for (i =
|
396
|
+
for (i = childViewsLength - 1; i >= items.get('length'); i--) {
|
392
397
|
childView = childViews.objectAt(i);
|
393
398
|
localItem = childView.get('localItem');
|
394
399
|
|
@@ -417,10 +422,10 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
417
422
|
// Update our value which may have changed
|
418
423
|
this.set('value', value);
|
419
424
|
|
420
|
-
} else if (
|
425
|
+
} else if (childViewsLength < items.get('length')) { // We've gained segments
|
421
426
|
|
422
427
|
// Create the new segments
|
423
|
-
for (i =
|
428
|
+
for (i = childViewsLength; i < items.get('length'); i++) {
|
424
429
|
|
425
430
|
// We create a default SC.ButtonView-like object for each segment
|
426
431
|
childView = segmentViewClass.create({
|
@@ -592,12 +597,12 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
592
597
|
value = this.get('value'),
|
593
598
|
overflowView = this.get('overflowView'),
|
594
599
|
isHorizontal = this.get('layoutDirection') === SC.LAYOUT_HORIZONTAL,
|
595
|
-
layoutProperty = isHorizontal ? 'width' : 'height',
|
596
600
|
visibleDim = isHorizontal ? this.$().width() : this.$().height(), // The inner width/height of the div
|
597
601
|
curElementsDim = 0,
|
598
602
|
dimToFit, length, i,
|
599
603
|
isOverflowing = NO,
|
600
604
|
wantsAutoResize = this.get('shouldAutoResize'),
|
605
|
+
layoutProperty = isHorizontal ? 'width' : 'height',
|
601
606
|
canAutoResize = !SC.none(this.getPath('layout.%@'.fmt(layoutProperty))),
|
602
607
|
willAutoResize = wantsAutoResize && canAutoResize;
|
603
608
|
|
@@ -851,7 +856,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
851
856
|
|
852
857
|
var childViews = this.get('childViews'),
|
853
858
|
childView,
|
854
|
-
overflowIndex = childViews.get('length') - 1,
|
855
859
|
index;
|
856
860
|
|
857
861
|
if (!this.get('isEnabledInPane')) return YES; // nothing to do // TODO: return NO?
|
@@ -863,6 +867,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
863
867
|
this.activeChildView = childView;
|
864
868
|
|
865
869
|
// if mouse was pressed on the overflow segment, popup the menu
|
870
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
866
871
|
if (index === overflowIndex) this.showOverflowMenu();
|
867
872
|
else this._isMouseDown = YES;
|
868
873
|
|
@@ -899,7 +904,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
899
904
|
/** @private */
|
900
905
|
mouseMoved: function (evt) {
|
901
906
|
var childViews = this.get('childViews'),
|
902
|
-
overflowIndex = childViews.get('length') - 1,
|
903
907
|
activeChildView,
|
904
908
|
childView,
|
905
909
|
index;
|
@@ -917,6 +921,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
917
921
|
if (childView.get('isEnabled')) childView.set('isActive', YES);
|
918
922
|
this.activeChildView = childView;
|
919
923
|
|
924
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
920
925
|
if (index === overflowIndex) {
|
921
926
|
this.showOverflowMenu();
|
922
927
|
this._isMouseDown = NO;
|
@@ -930,7 +935,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
930
935
|
mouseEntered: function (evt) {
|
931
936
|
var childViews = this.get('childViews'),
|
932
937
|
childView,
|
933
|
-
overflowIndex = childViews.get('length') - 1,
|
934
938
|
index;
|
935
939
|
|
936
940
|
// if mouse was pressed down initially, start detection again
|
@@ -938,6 +942,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
938
942
|
index = this.displayItemIndexForEvent(evt);
|
939
943
|
|
940
944
|
// if mouse was pressed on the overflow segment, popup the menu
|
945
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
941
946
|
if (index === overflowIndex) {
|
942
947
|
this.showOverflowMenu();
|
943
948
|
this._isMouseDown = NO;
|
@@ -970,7 +975,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
970
975
|
touchStart: function (touch) {
|
971
976
|
var childViews = this.get('childViews'),
|
972
977
|
childView,
|
973
|
-
overflowIndex = childViews.get('length') - 1,
|
974
978
|
index;
|
975
979
|
|
976
980
|
if (!this.get('isEnabledInPane')) return YES; // nothing to do
|
@@ -983,6 +987,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
983
987
|
this.activeChildView = childView;
|
984
988
|
|
985
989
|
// if touch was on the overflow segment, popup the menu
|
990
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
986
991
|
if (index === overflowIndex) this.showOverflowMenu();
|
987
992
|
else this._isTouching = YES;
|
988
993
|
}
|
@@ -1015,7 +1020,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
1015
1020
|
touchesDragged: function (evt, touches) {
|
1016
1021
|
var isTouching = this.touchIsInBoundary(evt),
|
1017
1022
|
childViews = this.get('childViews'),
|
1018
|
-
overflowIndex = childViews.get('length') - 1,
|
1019
1023
|
activeChildView,
|
1020
1024
|
childView,
|
1021
1025
|
index;
|
@@ -1036,6 +1040,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
1036
1040
|
|
1037
1041
|
this.activeChildView = childView;
|
1038
1042
|
|
1043
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
1039
1044
|
if (index === overflowIndex) {
|
1040
1045
|
this.showOverflowMenu();
|
1041
1046
|
this._isMouseDown = NO;
|
@@ -1067,11 +1072,11 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
1067
1072
|
_touchDidEnter: function (evt) {
|
1068
1073
|
var childViews = this.get('childViews'),
|
1069
1074
|
childView,
|
1070
|
-
overflowIndex = childViews.get('length') - 1,
|
1071
1075
|
index;
|
1072
1076
|
|
1073
1077
|
index = this.displayItemIndexForEvent(evt);
|
1074
1078
|
|
1079
|
+
var overflowIndex = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : null;
|
1075
1080
|
if (index === overflowIndex) {
|
1076
1081
|
this.showOverflowMenu();
|
1077
1082
|
this._isTouching = NO;
|
@@ -1258,6 +1263,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
1258
1263
|
var value = this.get('value'),
|
1259
1264
|
overflowItemsLength,
|
1260
1265
|
childViews = this.get('childViews'),
|
1266
|
+
childViewsLength = this.get('shouldHandleOverflow') ? childViews.get('length') - 1 : childViews.get('length'),
|
1261
1267
|
overflowIndex = Infinity,
|
1262
1268
|
overflowView = this.get('overflowView'),
|
1263
1269
|
childView;
|
@@ -1265,13 +1271,13 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
1265
1271
|
// The index where childViews are all overflowed
|
1266
1272
|
if (this.overflowItems) {
|
1267
1273
|
overflowItemsLength = this.overflowItems.get('length');
|
1268
|
-
overflowIndex =
|
1274
|
+
overflowIndex = childViewsLength - overflowItemsLength;
|
1269
1275
|
|
1270
1276
|
// Clear out the selected value of the overflowView (if it's set)
|
1271
1277
|
overflowView.set('isSelected', NO);
|
1272
1278
|
}
|
1273
1279
|
|
1274
|
-
for (var i =
|
1280
|
+
for (var i = childViewsLength - 1; i >= 0; i--) {
|
1275
1281
|
childView = childViews.objectAt(i);
|
1276
1282
|
if (SC.isArray(value) ? value.indexOf(childView.get('value')) >= 0 : value === childView.get('value')) {
|
1277
1283
|
childView.set('isSelected', YES);
|
@@ -40,7 +40,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
40
40
|
/**
|
41
41
|
The minimum value of the slider.
|
42
42
|
|
43
|
-
@type
|
43
|
+
@type Number
|
44
44
|
@default 0
|
45
45
|
*/
|
46
46
|
minimum: 0,
|
@@ -58,7 +58,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
58
58
|
/**
|
59
59
|
The maximum value of the slider bar.
|
60
60
|
|
61
|
-
@type
|
61
|
+
@type Number
|
62
62
|
@default 1
|
63
63
|
*/
|
64
64
|
maximum: 1,
|
@@ -78,7 +78,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
78
78
|
|
79
79
|
All values will be rounded to this step size when displayed.
|
80
80
|
|
81
|
-
@type
|
81
|
+
@type Number
|
82
82
|
@default 0.1
|
83
83
|
*/
|
84
84
|
step: 0.1,
|
@@ -87,8 +87,8 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
87
87
|
When set to true, this draws and positions an element for each step, giving
|
88
88
|
your theme the opportunity to show a mark at each step.
|
89
89
|
|
90
|
-
@type
|
91
|
-
@default
|
90
|
+
@type Boolean
|
91
|
+
@default false
|
92
92
|
*/
|
93
93
|
markSteps: false,
|
94
94
|
|
@@ -97,8 +97,8 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
97
97
|
value. Set to false to prevent a slider in a scroll view from hijacking scroll
|
98
98
|
events mid-scroll, for example.
|
99
99
|
|
100
|
-
@type
|
101
|
-
@default
|
100
|
+
@type Boolean
|
101
|
+
@default true
|
102
102
|
*/
|
103
103
|
updateOnScroll: true,
|
104
104
|
|
@@ -110,7 +110,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
110
110
|
displayProperties: ['displayValue', 'markSteps'],
|
111
111
|
|
112
112
|
/** @private
|
113
|
-
@
|
113
|
+
@type Number
|
114
114
|
The raw, unchanged value to be provided to screen readers and the like.
|
115
115
|
*/
|
116
116
|
ariaValue: function() {
|
@@ -126,7 +126,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
126
126
|
/*
|
127
127
|
The value, converted to a percent out of 100 between maximum and minimum.
|
128
128
|
|
129
|
-
@
|
129
|
+
@type Number
|
130
130
|
@readonly
|
131
131
|
*/
|
132
132
|
displayValue: function() {
|
@@ -137,9 +137,9 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
137
137
|
If a nonzero step is specified, this property contains an array of each step's value between
|
138
138
|
min and max (inclusive).
|
139
139
|
|
140
|
-
@
|
140
|
+
@type Array
|
141
|
+
@default null
|
141
142
|
@readonly
|
142
|
-
@type {Array|null}
|
143
143
|
*/
|
144
144
|
steps: function() {
|
145
145
|
var step = this.get('step');
|
@@ -163,9 +163,9 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
163
163
|
expressed as a fraction between 0 and 1 (inclusive). You can use these values to generate
|
164
164
|
and position labels for each step, for example.
|
165
165
|
|
166
|
-
@
|
166
|
+
@type Array
|
167
|
+
@default null
|
167
168
|
@readonly
|
168
|
-
@type {Array|null}
|
169
169
|
*/
|
170
170
|
stepPositions: function() {
|
171
171
|
var steps = this.get('steps');
|
@@ -181,7 +181,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
181
181
|
return ret;
|
182
182
|
}.property('steps').cacheable(),
|
183
183
|
|
184
|
-
|
184
|
+
/** @private Given a particular value, returns the percentage value. */
|
185
185
|
_displayValueForValue: function(value) {
|
186
186
|
var min = this.get('minimum'),
|
187
187
|
max = this.get('maximum'),
|
@@ -87,34 +87,51 @@ SC.RESIZE_AUTOMATIC = 'sc-automatic-resize';
|
|
87
87
|
SC.SplitView = SC.View.extend({
|
88
88
|
/**@scope SC.SplitView.prototype*/
|
89
89
|
|
90
|
-
/**
|
90
|
+
/**
|
91
|
+
@type Array
|
92
|
+
@default ['topLeftView', 'bottomRightView']
|
93
|
+
@readonly
|
94
|
+
@see SC.View#childViews
|
95
|
+
*/
|
96
|
+
childViews: ['topLeftView', 'bottomRightView'],
|
97
|
+
|
98
|
+
/**
|
99
|
+
@type Array
|
100
|
+
@default ['sc-split-view']
|
101
|
+
@readonly
|
102
|
+
@see SC.View#classNames
|
103
|
+
*/
|
91
104
|
classNames: ['sc-split-view'],
|
92
105
|
|
93
|
-
/**
|
94
|
-
|
106
|
+
/**
|
107
|
+
Used by the splitView computed property to find the nearest SplitView.
|
95
108
|
|
96
|
-
|
109
|
+
@type Boolean
|
110
|
+
@default true
|
111
|
+
@readonly
|
112
|
+
*/
|
97
113
|
isSplitView: YES,
|
98
114
|
|
99
115
|
/**
|
100
|
-
The class of view to create for the divider views. Override this to use a subclass of
|
101
|
-
or to implment your own.
|
102
|
-
|
103
|
-
@type
|
116
|
+
The class of view to create for the divider views. Override this to use a subclass of
|
117
|
+
SC.SplitDividerView, or to implment your own.
|
118
|
+
|
119
|
+
@type SC.View
|
104
120
|
@default SC.SplitDividerView
|
105
121
|
*/
|
106
122
|
splitDividerView: SC.SplitDividerView,
|
107
123
|
|
108
124
|
/**
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
125
|
+
Determines whether the SplitView should lay out its children
|
126
|
+
horizontally or vertically.
|
127
|
+
|
128
|
+
Possible values:
|
129
|
+
|
130
|
+
- SC.LAYOUT_HORIZONTAL: side-by-side
|
131
|
+
- SC.LAYOUT_VERTICAL: on top of each other
|
132
|
+
|
133
|
+
@type LayoutDirection
|
134
|
+
@default SC.LAYOUT_HORIZONTAL
|
118
135
|
*/
|
119
136
|
layoutDirection: SC.LAYOUT_HORIZONTAL,
|
120
137
|
|
@@ -125,7 +142,7 @@ SC.SplitView = SC.View.extend({
|
|
125
142
|
* If NO, the SplitView will decide its own size based on its children.
|
126
143
|
*
|
127
144
|
* @type Boolean
|
128
|
-
* @default
|
145
|
+
* @default true
|
129
146
|
*/
|
130
147
|
shouldResizeChildrenToFit: YES,
|
131
148
|
|
@@ -134,7 +151,8 @@ SC.SplitView = SC.View.extend({
|
|
134
151
|
* This allows the cursor to be used even if the user drags "too far",
|
135
152
|
* past the child's own boundaries.
|
136
153
|
*
|
137
|
-
* @type
|
154
|
+
* @type String
|
155
|
+
* @default null
|
138
156
|
*/
|
139
157
|
splitChildCursorStyle: null,
|
140
158
|
|
@@ -338,12 +356,9 @@ SC.SplitView = SC.View.extend({
|
|
338
356
|
if (lastNonDividerChild && !child.isSplitDivider) {
|
339
357
|
dividerId = SC.guidFor(lastNonDividerChild) + "-" + SC.guidFor(child);
|
340
358
|
|
359
|
+
// Try to re-use an existing divider.
|
341
360
|
divider = oldDividers[dividerId];
|
342
|
-
|
343
|
-
// if the previous view is a divider, but is not in our set of dividers,
|
344
|
-
// then it is manually created. If it is manually created, we should not
|
345
|
-
// create a new one.
|
346
|
-
if (!divider && !lastChild.isSplitDivider) {
|
361
|
+
if (!divider) {
|
347
362
|
divider = this.invokeDelegateMethod(del, 'splitViewDividerBetween', this, lastNonDividerChild, child);
|
348
363
|
}
|
349
364
|
|
@@ -545,7 +560,7 @@ SC.SplitView = SC.View.extend({
|
|
545
560
|
var isResizable = this.invokeDelegateMethod(del, 'splitViewShouldResizeChildToFit', this, child);
|
546
561
|
if (isResizable === useResizable) {
|
547
562
|
// if outOfSize === -1 then we are aggressively resizing (not resizing proportionally)
|
548
|
-
if (outOfSize === -1) size += diff
|
563
|
+
if (outOfSize === -1) size += diff;
|
549
564
|
else size += (size / outOfSize) * diff;
|
550
565
|
|
551
566
|
size = Math.round(size);
|
@@ -597,7 +612,7 @@ SC.SplitView = SC.View.extend({
|
|
597
612
|
* @returns {Number} The final position of the child.
|
598
613
|
*/
|
599
614
|
splitViewAdjustPositionForChild: function(splitView, child, position) {
|
600
|
-
var del = this.get('delegate');
|
615
|
+
// var del = this.get('delegate');
|
601
616
|
// Unlike tiling, the process of moving a child view is much more sophisticated.
|
602
617
|
//
|
603
618
|
// The basic sequence of events is simple:
|
@@ -103,24 +103,14 @@ SC.StaticContentView = SC.View.extend(
|
|
103
103
|
x: 0,
|
104
104
|
y: 0,
|
105
105
|
width: rect.width,
|
106
|
-
|
107
|
-
height: rect.height,
|
108
|
-
originalHeight: rect.height,
|
109
|
-
scale: 1,
|
110
|
-
transformOriginX: 0.5,
|
111
|
-
transformOriginY: 0.5
|
106
|
+
height: rect.height
|
112
107
|
};
|
113
108
|
} else {
|
114
109
|
return {
|
115
110
|
x: 0,
|
116
111
|
y: 0,
|
117
112
|
width: layer.clientWidth,
|
118
|
-
|
119
|
-
height: layer.clientHeight,
|
120
|
-
originalHeight: rect.height,
|
121
|
-
scale: 1,
|
122
|
-
transformOriginX: 0.5,
|
123
|
-
transformOriginY: 0.5
|
113
|
+
height: layer.clientHeight
|
124
114
|
};
|
125
115
|
}
|
126
116
|
}.property('content').cacheable(),
|