sproutcore 1.8.1 → 1.8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +17 -2
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/root_responder.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +26 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +117 -118
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +48 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +42 -40
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +55 -53
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/split_child.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +170 -170
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +22 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +5 -9
- metadata +2 -2
@@ -390,7 +390,7 @@ SC.AlertPane = SC.PanelPane.extend(
|
|
390
390
|
} else {
|
391
391
|
rootResponder = this.getPath('pane.rootResponder');
|
392
392
|
if(rootResponder) {
|
393
|
-
target = sender.get('
|
393
|
+
target = sender.get('customTarget');
|
394
394
|
rootResponder.sendAction(action, target || del, this, this, null, this);
|
395
395
|
}
|
396
396
|
}
|
@@ -451,7 +451,7 @@ SC.AlertPane.mixin(
|
|
451
451
|
|
452
452
|
buttonView.set('title'.fmt(idx), title);
|
453
453
|
if(action) buttonView.set('customAction'.fmt(idx), action);
|
454
|
-
if(target) buttonView.set('
|
454
|
+
if(target) buttonView.set('customTarget'.fmt(idx), target);
|
455
455
|
buttonView.set('isVisible', !!title);
|
456
456
|
buttonView.set('themeName', themeName);
|
457
457
|
});
|
@@ -212,16 +212,22 @@ test("AlertPane.info with individual actions and targets for three buttons", fun
|
|
212
212
|
clickValue = null;
|
213
213
|
}
|
214
214
|
|
215
|
+
function clickButton(button) {
|
216
|
+
var elem = button.$();
|
217
|
+
SC.Event.trigger(elem, 'mousedown');
|
218
|
+
SC.Event.trigger(elem, 'mouseup');
|
219
|
+
}
|
220
|
+
|
215
221
|
showPane();
|
216
|
-
|
222
|
+
clickButton(pane.get('button1'));
|
217
223
|
equals(clickValue, 'OK', 'Action for the OK button was clicked');
|
218
224
|
|
219
225
|
showPane();
|
220
|
-
|
226
|
+
clickButton(pane.get('button2'));
|
221
227
|
equals(clickValue, 'Cancel', 'Action for the Cancel button was clicked');
|
222
228
|
|
223
229
|
showPane();
|
224
|
-
|
230
|
+
clickButton(pane.get('button3'));
|
225
231
|
equals(clickValue, 'Extra', 'Action for the Extra button was clicked');
|
226
232
|
|
227
233
|
});
|
@@ -12,33 +12,33 @@
|
|
12
12
|
var iv=SC.ImageView.design({value: appleURL, layout: {height:400, width:400}});
|
13
13
|
var pane = SC.ControlTestPane.design({ height: 100 })
|
14
14
|
.add("basic", SC.ScrollView, {
|
15
|
-
|
15
|
+
|
16
16
|
})
|
17
17
|
|
18
18
|
.add("basic2", SC.ScrollView, {
|
19
19
|
contentView: iv
|
20
20
|
})
|
21
|
-
|
21
|
+
|
22
22
|
.add("basic3", SC.ScrollView, {
|
23
23
|
contentView: iv,
|
24
24
|
isHorizontalScrollerVisible: NO,
|
25
25
|
autohidesHorizontalScroller: NO,
|
26
26
|
autohidesVerticalScroller: NO
|
27
27
|
})
|
28
|
-
|
28
|
+
|
29
29
|
.add("disabled", SC.ScrollView, {
|
30
30
|
isEnabled: NO
|
31
31
|
})
|
32
|
-
|
32
|
+
|
33
33
|
.add("verticalScrollerBottom",SC.ScrollView, {
|
34
34
|
contentView: iv,
|
35
35
|
hasHorizontalScroller : NO,
|
36
36
|
verticalScrollerBottom: 16,
|
37
37
|
isVerticalScrollerVisible: YES,
|
38
38
|
autohidesVerticalScroller: NO
|
39
|
-
|
39
|
+
|
40
40
|
})
|
41
|
-
.add("aria-
|
41
|
+
.add("aria-attributes", SC.ScrollView, {
|
42
42
|
contentView: iv
|
43
43
|
});
|
44
44
|
|
@@ -46,14 +46,14 @@
|
|
46
46
|
|
47
47
|
// ..........................................................
|
48
48
|
// TEST VIEWS
|
49
|
-
//
|
49
|
+
//
|
50
50
|
module('SC.ScrollView UI', pane.standardSetup());
|
51
|
-
|
51
|
+
|
52
52
|
test("basic", function() {
|
53
53
|
var view = pane.view('basic');
|
54
54
|
ok(!view.$().hasClass('disabled'), 'should not have disabled class');
|
55
55
|
ok(!view.$().hasClass('sel'), 'should not have sel class');
|
56
|
-
|
56
|
+
|
57
57
|
equals(view.getPath('childViews.length'), 3, 'scroll view should have only three child views');
|
58
58
|
|
59
59
|
var containerView = view.get('containerView') ;
|
@@ -62,11 +62,11 @@
|
|
62
62
|
ok(containerView.get('contentView') === null, 'default containerView should have a null contentView itself');
|
63
63
|
ok(view.get('contentView') === null, 'scroll view should have no contentView by default');
|
64
64
|
equals(containerView.getPath('childViews.length'), 0, 'containerView should have no child views');
|
65
|
-
|
65
|
+
|
66
66
|
var horizontalScrollerView = view.get('horizontalScrollerView');
|
67
67
|
ok(view.get('hasHorizontalScroller'), 'default scroll view wants a horizontal scroller');
|
68
68
|
ok(horizontalScrollerView, 'default scroll view has a horizontal scroller');
|
69
|
-
|
69
|
+
|
70
70
|
var verticalScrollerView = view.get('verticalScrollerView');
|
71
71
|
ok(view.get('hasVerticalScroller'), 'default scroll view wants a vertical scroller');
|
72
72
|
ok(verticalScrollerView, 'default scroll view has a vertical scroller');
|
@@ -74,43 +74,43 @@
|
|
74
74
|
|
75
75
|
test("basic2", function() {
|
76
76
|
var view = pane.view('basic2');
|
77
|
-
ok(view.$().hasClass('sc-scroll-view'), 'should have sc-scroll-view class');
|
78
|
-
|
77
|
+
ok(view.$().hasClass('sc-scroll-view'), 'should have sc-scroll-view class');
|
78
|
+
|
79
79
|
var horizontalScrollerView = view.get('horizontalScrollerView');
|
80
80
|
ok(view.get('hasHorizontalScroller'), 'default scroll view wants a horizontal scroller');
|
81
81
|
ok(horizontalScrollerView, 'default scroll view has a horizontal scroller');
|
82
|
-
ok(horizontalScrollerView.$().hasClass('sc-horizontal'), 'should have sc-horizontal class');
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
ok(horizontalScrollerView.$().hasClass('sc-horizontal'), 'should have sc-horizontal class');
|
83
|
+
var maxHScroll = view.maximumHorizontalScrollOffset();
|
84
|
+
ok((maxHScroll > 0), 'Max horizontal scroll should be greater than zero');
|
85
|
+
|
86
86
|
var verticalScrollerView = view.get('verticalScrollerView');
|
87
87
|
ok(view.get('hasVerticalScroller'), 'default scroll view wants a vertical scroller');
|
88
88
|
ok(verticalScrollerView, 'default scroll view has a vertical scroller');
|
89
|
-
ok(verticalScrollerView.$().hasClass('sc-vertical'), 'should have sc-vertical class');
|
90
|
-
|
91
|
-
|
89
|
+
ok(verticalScrollerView.$().hasClass('sc-vertical'), 'should have sc-vertical class');
|
90
|
+
var maxVScroll = view.maximumVerticalScrollOffset();
|
91
|
+
ok((maxVScroll > 0), 'Max vertical scroll should be greater than zero');
|
92
92
|
|
93
93
|
view.scrollTo(0,100);
|
94
94
|
SC.RunLoop.begin().end();
|
95
95
|
var elem = view.get('containerView').$()[0];
|
96
96
|
equals(elem.scrollTop, 100, 'vertical scrolling should adjust scrollTop of container view');
|
97
|
-
|
97
|
+
|
98
98
|
view.scrollTo(50,0);
|
99
99
|
SC.RunLoop.begin().end();
|
100
100
|
elem = view.get('containerView').$()[0];
|
101
101
|
equals(elem.scrollLeft, 50, 'horizontal scrolling should adjust scrollLeft of container view');
|
102
102
|
});
|
103
|
-
|
103
|
+
|
104
104
|
test("basic3", function() {
|
105
105
|
var view = pane.view('basic3');
|
106
106
|
view.set('isHorizontalScrollerVisible',NO);
|
107
107
|
ok(!view.get('canScrollHorizontal'),'cannot scroll in horizontal direction');
|
108
|
-
ok(view.$().hasClass('sc-scroll-view'), 'should have sc-scroll-view class');
|
108
|
+
ok(view.$().hasClass('sc-scroll-view'), 'should have sc-scroll-view class');
|
109
109
|
var horizontalScrollerView = view.get('horizontalScrollerView');
|
110
110
|
ok(view.get('hasHorizontalScroller'), 'default scroll view wants a horizontal scroller');
|
111
111
|
ok(horizontalScrollerView, 'default scroll view has a horizontal scroller');
|
112
|
-
ok(horizontalScrollerView.$().hasClass('sc-horizontal'), 'should have sc-horizontal class');
|
113
|
-
var maxHScroll = view.maximumHorizontalScrollOffset();
|
112
|
+
ok(horizontalScrollerView.$().hasClass('sc-horizontal'), 'should have sc-horizontal class');
|
113
|
+
var maxHScroll = view.maximumHorizontalScrollOffset();
|
114
114
|
equals(maxHScroll , 0, 'Max horizontal scroll should be equal to zero');
|
115
115
|
|
116
116
|
view.set('isVerticalScrollerVisible',NO);
|
@@ -118,26 +118,26 @@
|
|
118
118
|
var verticalScrollerView = view.get('verticalScrollerView');
|
119
119
|
ok(view.get('hasVerticalScroller'), 'default scroll view wants a vertical scroller');
|
120
120
|
ok(verticalScrollerView, 'default scroll view has a vertical scroller');
|
121
|
-
ok(verticalScrollerView.$().hasClass('sc-vertical'), 'should have sc-vertical class');
|
122
|
-
var maxVScroll = view.maximumVerticalScrollOffset();
|
121
|
+
ok(verticalScrollerView.$().hasClass('sc-vertical'), 'should have sc-vertical class');
|
122
|
+
var maxVScroll = view.maximumVerticalScrollOffset();
|
123
123
|
equals(maxVScroll ,0, 'Max vertical scroll should be equal to zero');
|
124
124
|
});
|
125
125
|
|
126
126
|
test("disabled", function() {
|
127
|
-
var view = pane.view('disabled');
|
127
|
+
var view = pane.view('disabled');
|
128
128
|
ok(view.$().hasClass('disabled'), 'should have disabled class');
|
129
129
|
ok(!view.$().hasClass('sel'), 'should not have sel class');
|
130
130
|
});
|
131
131
|
|
132
132
|
test("non-zero bottom in vertical scrollbar", function() {
|
133
|
-
var view = pane.view('verticalScrollerBottom');
|
133
|
+
var view = pane.view('verticalScrollerBottom');
|
134
134
|
equals(view.get('verticalScrollerBottom'),16, "should have verticalScrollerBottom as ");
|
135
135
|
var scroller = view.get('verticalScrollerView') ;
|
136
136
|
ok(scroller, 'should have vertical scroller view ');
|
137
137
|
equals(scroller.get('layout').bottom,16, 'should have layout.bottom of scroller as ');
|
138
138
|
equals(scroller.$()[0].style.bottom,'16px', 'should have style.bottom of scroller as ');
|
139
139
|
});
|
140
|
-
|
140
|
+
|
141
141
|
test('ScrollView should readjust scrollTop/scrollLeft if layer changes', function() {
|
142
142
|
var view = pane.view('basic2'), cv = view.get('contentView'), container = view.get('containerView') ;
|
143
143
|
view.scrollTo(10, 10);
|
@@ -150,13 +150,23 @@
|
|
150
150
|
equals(container.get('layer').scrollTop, 10, 'scrollTop should be readjust to 10');
|
151
151
|
});
|
152
152
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
153
|
+
test('Scroller views of scroll view should have aria attributes set', function() {
|
154
|
+
var view = pane.view("aria-attributes"),
|
155
|
+
horizontalScrollerView = view.get('horizontalScrollerView'),
|
156
|
+
verticalScrollerView = view.get('verticalScrollerView'),
|
157
|
+
contentView = view.get('contentView');
|
158
|
+
|
159
|
+
equals(horizontalScrollerView.$().attr('aria-controls'), contentView.get('layerId'), "horizontalScroller has aria-controls set");
|
160
|
+
equals(verticalScrollerView.$().attr('aria-controls'), contentView.get('layerId'), "verticalScroller has aria-controls set");
|
161
|
+
equals(horizontalScrollerView.$().attr('aria-orientation'), 'horizontal', "horizontalScroller has aria-orientation set");
|
162
|
+
equals(verticalScrollerView.$().attr('aria-orientation'), 'vertical', "verticalScroller has aria-orientation set");
|
163
|
+
equals(horizontalScrollerView.$().attr('aria-valuemin'), 0, "horizontalScroller has aria-valuemin set");
|
164
|
+
equals(verticalScrollerView.$().attr('aria-valuemin'), 0, "verticalScroller has aria-valuemin set");
|
165
|
+
equals(horizontalScrollerView.$().attr('aria-valuemax'), view.get('maximumHorizontalScrollOffset') - horizontalScrollerView.get('scrollbarThickness'), "horizontalScroller has aria-valuemax set");
|
166
|
+
equals(verticalScrollerView.$().attr('aria-valuemax'), view.get('maximumVerticalScrollOffset') - verticalScrollerView.get('scrollbarThickness'), "verticalScroller has aria-valuemax set");
|
167
|
+
equals(horizontalScrollerView.$().attr('aria-valuenow'), view.get('horizontalScrollOffset'), "horizontalScroller has aria-valuenow set");
|
168
|
+
equals(verticalScrollerView.$().attr('aria-valuenow'), view.get('horizontalScrollOffset'), "verticalScroller has aria-valuenow set");
|
169
|
+
|
170
|
+
});
|
158
171
|
|
159
|
-
equals(horizontalScrollerView.$().attr('aria-controls'), contentView, "horizontalScroller has aria-controls set");
|
160
|
-
equals(verticalScrollerView.$().attr('aria-controls'), contentView, "verticalScroller has aria-controls set");
|
161
|
-
});
|
162
172
|
})();
|
@@ -24,7 +24,7 @@ SC.GridView = SC.ListView.extend(
|
|
24
24
|
@see SC.View#classNames
|
25
25
|
*/
|
26
26
|
classNames: ['sc-grid-view'],
|
27
|
-
|
27
|
+
|
28
28
|
/**
|
29
29
|
@type Hash
|
30
30
|
@default { left:0, right:0, top:0, bottom:0 }
|
@@ -32,21 +32,21 @@ SC.GridView = SC.ListView.extend(
|
|
32
32
|
*/
|
33
33
|
layout: { left:0, right:0, top:0, bottom:0 },
|
34
34
|
|
35
|
-
/**
|
35
|
+
/**
|
36
36
|
The common row height for grid items.
|
37
|
-
|
37
|
+
|
38
38
|
The value should be an integer expressed in pixels.
|
39
|
-
|
39
|
+
|
40
40
|
@type Number
|
41
41
|
@default 48
|
42
42
|
*/
|
43
43
|
rowHeight: 48,
|
44
|
-
|
44
|
+
|
45
45
|
/**
|
46
46
|
The minimum column width for grid items. Items will actually
|
47
47
|
be laid out as needed to completely fill the space, but the minimum
|
48
48
|
width of each item will be this value.
|
49
|
-
|
49
|
+
|
50
50
|
@type Number
|
51
51
|
@default 64
|
52
52
|
*/
|
@@ -54,25 +54,25 @@ SC.GridView = SC.ListView.extend(
|
|
54
54
|
|
55
55
|
/**
|
56
56
|
The default example item view will render text-based items.
|
57
|
-
|
57
|
+
|
58
58
|
You can override this as you wish.
|
59
|
-
|
59
|
+
|
60
60
|
@type SC.View
|
61
61
|
@default SC.LabelView
|
62
62
|
*/
|
63
63
|
exampleView: SC.LabelView,
|
64
|
-
|
64
|
+
|
65
65
|
/**
|
66
66
|
Possible values:
|
67
|
-
|
67
|
+
|
68
68
|
- SC.HORIZONTAL_ORIENTATION
|
69
69
|
- SC.VERTICAL_ORIENTATION
|
70
|
-
|
70
|
+
|
71
71
|
@type String
|
72
72
|
@default SC.HORIZONTAL_ORIENTATION
|
73
73
|
*/
|
74
74
|
insertionOrientation: SC.HORIZONTAL_ORIENTATION,
|
75
|
-
|
75
|
+
|
76
76
|
/** @private */
|
77
77
|
itemsPerRow: function() {
|
78
78
|
var f = this.get('frame'),
|
@@ -80,9 +80,9 @@ SC.GridView = SC.ListView.extend(
|
|
80
80
|
|
81
81
|
return (columnWidth <= 0) ? 1 : Math.floor(f.width / columnWidth) ;
|
82
82
|
}.property('clippingFrame', 'columnWidth').cacheable(),
|
83
|
-
|
83
|
+
|
84
84
|
/** @private
|
85
|
-
Find the contentIndexes to display in the passed rect. Note that we
|
85
|
+
Find the contentIndexes to display in the passed rect. Note that we
|
86
86
|
ignore the width of the rect passed since we need to have a single
|
87
87
|
contiguous range.
|
88
88
|
*/
|
@@ -93,7 +93,7 @@ SC.GridView = SC.ListView.extend(
|
|
93
93
|
max = Math.ceil(SC.maxY(rect) / rowHeight) * itemsPerRow ;
|
94
94
|
return SC.IndexSet.create(min, max-min);
|
95
95
|
},
|
96
|
-
|
96
|
+
|
97
97
|
/** @private */
|
98
98
|
layoutForContentIndex: function(contentIndex) {
|
99
99
|
var rowHeight = this.get('rowHeight') || 48,
|
@@ -102,14 +102,14 @@ SC.GridView = SC.ListView.extend(
|
|
102
102
|
columnWidth = Math.floor(frameWidth/itemsPerRow),
|
103
103
|
row = Math.floor(contentIndex / itemsPerRow),
|
104
104
|
col = contentIndex - (itemsPerRow*row) ;
|
105
|
-
return {
|
105
|
+
return {
|
106
106
|
left: col * columnWidth,
|
107
107
|
top: row * rowHeight,
|
108
108
|
height: rowHeight,
|
109
109
|
width: columnWidth
|
110
110
|
};
|
111
111
|
},
|
112
|
-
|
112
|
+
|
113
113
|
/** @private
|
114
114
|
Overrides default CollectionView method to compute the minimum height
|
115
115
|
of the list view.
|
@@ -120,32 +120,32 @@ SC.GridView = SC.ListView.extend(
|
|
120
120
|
rowHeight = this.get('rowHeight') || 48,
|
121
121
|
itemsPerRow = this.get('itemsPerRow'),
|
122
122
|
rows = Math.ceil(count / itemsPerRow) ;
|
123
|
-
|
123
|
+
|
124
124
|
// use this cached layout hash to avoid allocing memory...
|
125
125
|
var ret = this._cachedLayoutHash ;
|
126
126
|
if (!ret) ret = this._cachedLayoutHash = {};
|
127
|
-
|
127
|
+
|
128
128
|
// set minHeight
|
129
129
|
ret.minHeight = rows * rowHeight ;
|
130
130
|
this.calculatedHeight = ret.minHeight;
|
131
|
-
return ret;
|
131
|
+
return ret;
|
132
132
|
},
|
133
|
-
|
133
|
+
|
134
134
|
/**
|
135
135
|
@type SC.View
|
136
136
|
*/
|
137
137
|
insertionPointClass: SC.View.extend({
|
138
138
|
classNames: ['grid-insertion-point'],
|
139
|
-
|
139
|
+
|
140
140
|
render: function(context, firstTime) {
|
141
141
|
if (firstTime) context.push('<span class="anchor"></span>') ;
|
142
142
|
}
|
143
143
|
}),
|
144
|
-
|
144
|
+
|
145
145
|
/** @private */
|
146
146
|
showInsertionPoint: function(itemView, dropOperation) {
|
147
147
|
if (!itemView) return ;
|
148
|
-
|
148
|
+
|
149
149
|
// if drop on, then just add a class...
|
150
150
|
if (dropOperation === SC.DROP_ON) {
|
151
151
|
if (itemView !== this._dropOnInsertionPoint) {
|
@@ -153,24 +153,24 @@ SC.GridView = SC.ListView.extend(
|
|
153
153
|
//itemView.addClassName('drop-target') ;
|
154
154
|
this._dropOnInsertionPoint = itemView ;
|
155
155
|
}
|
156
|
-
|
156
|
+
|
157
157
|
} else {
|
158
|
-
|
158
|
+
|
159
159
|
if (this._dropOnInsertionPoint) {
|
160
160
|
//this._dropOnInsertionPoint.removeClassName('drop-target') ;
|
161
161
|
this._dropOnInsertionPoint = null ;
|
162
162
|
}
|
163
|
-
|
163
|
+
|
164
164
|
if (!this._insertionPointView) {
|
165
165
|
this._insertionPointView = this.insertionPointClass.create() ;
|
166
166
|
}
|
167
|
-
|
167
|
+
|
168
168
|
var insertionPoint = this._insertionPointView ;
|
169
169
|
var itemViewFrame = itemView.get('frame') ;
|
170
|
-
var f = { height: itemViewFrame.height - 6,
|
171
|
-
x: itemViewFrame.x,
|
172
|
-
y: itemViewFrame.y + 6,
|
173
|
-
width: 0
|
170
|
+
var f = { height: itemViewFrame.height - 6,
|
171
|
+
x: itemViewFrame.x,
|
172
|
+
y: itemViewFrame.y + 6,
|
173
|
+
width: 0
|
174
174
|
};
|
175
175
|
|
176
176
|
if (!SC.rectsEqual(insertionPoint.get('frame'), f)) {
|
@@ -181,9 +181,9 @@ SC.GridView = SC.ListView.extend(
|
|
181
181
|
itemView.parentNode.appendChild(insertionPoint) ;
|
182
182
|
}
|
183
183
|
}
|
184
|
-
|
184
|
+
|
185
185
|
},
|
186
|
-
|
186
|
+
|
187
187
|
/** @private */
|
188
188
|
hideInsertionPoint: function() {
|
189
189
|
var insertionPoint = this._insertionPointView ;
|
@@ -194,9 +194,9 @@ SC.GridView = SC.ListView.extend(
|
|
194
194
|
this._dropOnInsertionPoint = null ;
|
195
195
|
}
|
196
196
|
},
|
197
|
-
|
197
|
+
|
198
198
|
/** @private */
|
199
|
-
insertionIndexForLocation: function(loc, dropOperation) {
|
199
|
+
insertionIndexForLocation: function(loc, dropOperation) {
|
200
200
|
var f = this.get('frame'),
|
201
201
|
sf = this.get('clippingFrame'),
|
202
202
|
itemsPerRow = this.get('itemsPerRow'),
|
@@ -207,7 +207,7 @@ SC.GridView = SC.ListView.extend(
|
|
207
207
|
offset = (loc.x - f.x - sf.x),
|
208
208
|
col = Math.floor(offset / columnWidth),
|
209
209
|
percentage = (offset / columnWidth) - col ;
|
210
|
-
|
210
|
+
|
211
211
|
// if the dropOperation is SC.DROP_ON and we are in the center 60%
|
212
212
|
// then return the current item.
|
213
213
|
if (dropOperation === SC.DROP_ON) {
|
@@ -218,7 +218,7 @@ SC.GridView = SC.ListView.extend(
|
|
218
218
|
} else {
|
219
219
|
if (percentage > 0.45) col++ ;
|
220
220
|
}
|
221
|
-
|
221
|
+
|
222
222
|
// convert to index
|
223
223
|
var ret= (row*itemsPerRow) + col ;
|
224
224
|
return [ret, retOp] ;
|
@@ -235,9 +235,11 @@ SC.GridView = SC.ListView.extend(
|
|
235
235
|
|
236
236
|
len = nowShowing.get('length');
|
237
237
|
|
238
|
-
|
238
|
+
// Only loop through the now showing indexes, if the content is sparsely
|
239
|
+
// loaded we could inadvertently trigger reloading unneeded content.
|
240
|
+
nowShowing.forEach(function(idx) {
|
239
241
|
itemView = this.itemViewForContentIndex(idx);
|
240
242
|
itemView.adjust(this.layoutForContentIndex(idx));
|
241
|
-
}
|
243
|
+
}, this);
|
242
244
|
}.observes('clippingFrame')
|
243
245
|
}) ;
|