sproutcore 1.10.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION.yml +1 -1
- data/bin/sc-phantom +13 -0
- data/lib/Buildfile +3 -0
- data/lib/buildtasks/manifest.rake +3 -0
- data/lib/frameworks/sproutcore/CHANGELOG.md +24 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/high_light.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/page_item_view.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +4 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +44 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +167 -91
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/touch.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +7 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +26 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +9 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +25 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +29 -29
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +107 -106
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +120 -134
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +197 -196
- data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +22 -10
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +90 -79
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/advanced/event_queuing.js +104 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/handlebars.js +2 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/grid.css +17 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +1 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/panel/panel.css +2 -2
- data/lib/frameworks/sproutcore/themes/empty_theme/theme.js +1 -1
- data/lib/sproutcore/tools.rb +2 -1
- data/lib/sproutcore/tools/phantom.rb +36 -0
- data/sproutcore.gemspec +1 -1
- data/vendor/chance/lib/chance/instance.rb +5 -2
- metadata +11 -4
@@ -49,14 +49,14 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
49
49
|
@type Number
|
50
50
|
@observes maximum
|
51
51
|
*/
|
52
|
-
value: function(key, val) {
|
52
|
+
value: function (key, val) {
|
53
53
|
if (val !== undefined) {
|
54
54
|
// Don't enforce the maximum now, because the scroll view could change
|
55
55
|
// height and we want our content to stay put when it does.
|
56
|
-
this._value = val
|
56
|
+
this._value = val;
|
57
57
|
} else {
|
58
|
-
var value = this._value || 0
|
59
|
-
return Math.min(value, this.get('maximum'))
|
58
|
+
var value = this._value || 0; // default value is at top/left
|
59
|
+
return Math.min(value, this.get('maximum'));
|
60
60
|
}
|
61
61
|
}.property('maximum').cacheable(),
|
62
62
|
|
@@ -111,7 +111,7 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
111
111
|
@type String
|
112
112
|
@default 'verticalScrollOffset'
|
113
113
|
*/
|
114
|
-
ownerScrollValueKey: function() {
|
114
|
+
ownerScrollValueKey: function () {
|
115
115
|
return 'verticalScrollOffset';
|
116
116
|
}.property('layoutDirection').cacheable(),
|
117
117
|
|
@@ -121,67 +121,53 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
121
121
|
//
|
122
122
|
|
123
123
|
/** @private */
|
124
|
-
init: function() {
|
124
|
+
init: function () {
|
125
125
|
// Set the scrollerThickness based on controlSize
|
126
126
|
switch (this.get('controlSize')) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
127
|
+
case SC.TINY_CONTROL_SIZE:
|
128
|
+
this.set('scrollerThickness', SC.MenuScrollerView.TINY_SCROLLER_THICKNESS);
|
129
|
+
break;
|
130
|
+
case SC.SMALL_CONTROL_SIZE:
|
131
|
+
this.set('scrollerThickness', SC.MenuScrollerView.SMALL_SCROLLER_THICKNESS);
|
132
|
+
break;
|
133
|
+
case SC.REGULAR_CONTROL_SIZE:
|
134
|
+
this.set('scrollerThickness', SC.MenuScrollerView.REGULAR_SCROLLER_THICKNESS);
|
135
|
+
break;
|
136
|
+
case SC.LARGE_CONTROL_SIZE:
|
137
|
+
this.set('scrollerThickness', SC.MenuScrollerView.LARGE_SCROLLER_THICKNESS);
|
138
|
+
break;
|
139
|
+
case SC.HUGE_CONTROL_SIZE:
|
140
|
+
this.set('scrollerThickness', SC.MenuScrollerView.HUGE_SCROLLER_THICKNESS);
|
141
|
+
break;
|
142
142
|
}
|
143
143
|
|
144
144
|
return sc_super();
|
145
145
|
},
|
146
146
|
|
147
147
|
/** @private */
|
148
|
-
render: function(context, firstTime) {
|
149
|
-
context.addClass('sc-vertical')
|
148
|
+
render: function (context, firstTime) {
|
149
|
+
context.addClass('sc-vertical');
|
150
150
|
context.addClass(this.get('controlSize'));
|
151
151
|
if (firstTime) {
|
152
|
-
var direction = this.get('scrollDown') ? 'arrowDown' : 'arrowUp'
|
153
|
-
context.push('<span class="scrollArrow '+direction+'"> </span>')
|
152
|
+
var direction = this.get('scrollDown') ? 'arrowDown' : 'arrowUp';
|
153
|
+
context.push('<span class="scrollArrow ' + direction + '"> </span>');
|
154
154
|
}
|
155
155
|
},
|
156
156
|
|
157
157
|
/** @private */
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
// callback = this._sc_scroller_scrollDidChange ;
|
162
|
-
// SC.Event.add(this.$(), 'scroll', this, callback) ;
|
163
|
-
//
|
164
|
-
// // set scrollOffset first time
|
165
|
-
// amt = this.get('value') ;
|
166
|
-
// layer = this.get('layer') ;
|
167
|
-
//
|
168
|
-
// layer.scrollTop = amt ;
|
158
|
+
willDestroyLayer: function () {
|
159
|
+
var callback = this._sc_scroller_scrollDidChange;
|
160
|
+
SC.Event.remove(this.$(), 'scroll', this, callback);
|
169
161
|
},
|
170
162
|
|
171
163
|
/** @private */
|
172
|
-
|
173
|
-
var callback = this._sc_scroller_scrollDidChange ;
|
174
|
-
SC.Event.remove(this.$(), 'scroll', this, callback) ;
|
175
|
-
},
|
176
|
-
|
177
|
-
/** @private */
|
178
|
-
mouseEntered: function(evt) {
|
164
|
+
mouseEntered: function (evt) {
|
179
165
|
this.set('isMouseOver', YES);
|
180
166
|
this._invokeScrollOnMouseOver();
|
181
167
|
},
|
182
168
|
|
183
169
|
/** @private */
|
184
|
-
mouseExited: function(evt) {
|
170
|
+
mouseExited: function (evt) {
|
185
171
|
this.set('isMouseOver', NO);
|
186
172
|
},
|
187
173
|
|
@@ -190,38 +176,36 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
190
176
|
SC.MenuScroller and SC.MenuScroll use valueBinding so this function is
|
191
177
|
not necessary.
|
192
178
|
*/
|
193
|
-
_sc_scroller_valueDidChange: function() {}.observes('value'),
|
179
|
+
_sc_scroller_valueDidChange: function () {}.observes('value'),
|
194
180
|
|
195
181
|
|
196
182
|
/** @private */
|
197
|
-
_sc_scroller_armScrollTimer: function() {
|
183
|
+
_sc_scroller_armScrollTimer: function () {
|
198
184
|
if (!this._sc_scrollTimer) {
|
199
|
-
SC.
|
200
|
-
|
201
|
-
|
202
|
-
|
185
|
+
SC.run(function () {
|
186
|
+
var method = this._sc_scroller_scrollDidChange;
|
187
|
+
this._sc_scrollTimer = this.invokeLater(method, 50);
|
188
|
+
});
|
203
189
|
}
|
204
190
|
},
|
205
191
|
|
206
192
|
/** @private */
|
207
|
-
_sc_scroller_scrollDidChange: function() {
|
193
|
+
_sc_scroller_scrollDidChange: function () {
|
208
194
|
var now = Date.now(),
|
209
195
|
last = this._sc_lastScroll,
|
210
196
|
layer = this.get('layer'),
|
211
|
-
scroll = 0
|
212
|
-
|
213
|
-
if (last && (now-last)<50) return this._sc_scroller_armScrollTimer() ;
|
214
|
-
this._sc_scrollTimer = null ;
|
215
|
-
this._sc_lastScroll = now ;
|
197
|
+
scroll = 0;
|
216
198
|
|
217
|
-
|
199
|
+
if (last && (now - last) < 50) return this._sc_scroller_armScrollTimer();
|
200
|
+
this._sc_scrollTimer = null;
|
201
|
+
this._sc_lastScroll = now;
|
218
202
|
|
219
|
-
|
203
|
+
SC.run(function () {
|
204
|
+
if (!this.get('isEnabledInPane')) return; // nothing to do.
|
220
205
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
SC.RunLoop.end();
|
206
|
+
this._sc_scrollValue = scroll = layer.scrollTop;
|
207
|
+
this.set('value', scroll); // will now enforce minimum and maximum
|
208
|
+
});
|
225
209
|
},
|
226
210
|
|
227
211
|
|
@@ -229,22 +213,22 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
229
213
|
Scroll the menu if it is is an up or down arrow. This is called by
|
230
214
|
the function that simulates mouseOver.
|
231
215
|
*/
|
232
|
-
_scrollMenu: function(){
|
216
|
+
_scrollMenu: function () {
|
233
217
|
var val = this.get('value'), newval;
|
234
|
-
if(this.get('scrollDown')) {
|
235
|
-
newval = val+this.verticalLineScroll;
|
236
|
-
if(newval<=this.get('maximum')){
|
218
|
+
if (this.get('scrollDown')) {
|
219
|
+
newval = val + this.verticalLineScroll;
|
220
|
+
if (newval <= this.get('maximum')) {
|
237
221
|
this.set('value', newval);
|
238
222
|
}
|
239
|
-
}
|
240
|
-
|
241
|
-
newval
|
242
|
-
if(newval>=0){
|
223
|
+
} else {
|
224
|
+
newval = val - this.verticalLineScroll;
|
225
|
+
if (newval >= 0) {
|
243
226
|
this.set('value', newval);
|
244
|
-
}else if(val<=this.verticalLineScroll && val>0){
|
227
|
+
} else if (val <= this.verticalLineScroll && val > 0) {
|
245
228
|
this.set('value', 0);
|
246
229
|
}
|
247
230
|
}
|
231
|
+
|
248
232
|
return YES;
|
249
233
|
},
|
250
234
|
|
@@ -254,9 +238,9 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
254
238
|
isMouseOver which is turned on when mouseEntered is called and turned off
|
255
239
|
when mouseExited is called.
|
256
240
|
*/
|
257
|
-
_invokeScrollOnMouseOver: function(){
|
241
|
+
_invokeScrollOnMouseOver: function () {
|
258
242
|
this._scrollMenu();
|
259
|
-
if(this.get('isMouseOver')){
|
243
|
+
if (this.get('isMouseOver')) {
|
260
244
|
this.invokeLater(this._invokeScrollOnMouseOver, 50);
|
261
245
|
}
|
262
246
|
}
|
@@ -474,11 +458,11 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
474
458
|
/**
|
475
459
|
@param {SC.View} view
|
476
460
|
*/
|
477
|
-
scrollToVisible: function(view) {
|
461
|
+
scrollToVisible: function (view) {
|
478
462
|
// if no view is passed, do default
|
479
463
|
if (arguments.length === 0) return sc_super();
|
480
464
|
|
481
|
-
var contentView = this.get('contentView')
|
465
|
+
var contentView = this.get('contentView');
|
482
466
|
if (!contentView) return NO; // nothing to do if no contentView.
|
483
467
|
|
484
468
|
// get the frame for the view - should work even for views with static
|
@@ -488,7 +472,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
488
472
|
|
489
473
|
// convert view's frame to an offset from the contentView origin. This
|
490
474
|
// will become the new scroll offset after some adjustment.
|
491
|
-
vf = contentView.convertFrameFromView(vf, view.get('parentView'))
|
475
|
+
vf = contentView.convertFrameFromView(vf, view.get('parentView'));
|
492
476
|
|
493
477
|
var vscroll2 = this.get('verticalScrollerView2');
|
494
478
|
if (vscroll2 && vscroll2.get('isVisible')) {
|
@@ -511,22 +495,22 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
511
495
|
You may also want to override this method to handle layout for any
|
512
496
|
additional controls you have added to the view.
|
513
497
|
*/
|
514
|
-
tile: function() {
|
498
|
+
tile: function () {
|
515
499
|
// get vertical scroller/determine if we should have a scroller
|
516
500
|
var hasScroller, vscroll, vscroll2, hasVertical, clip, clipLayout, viewportHeight;
|
517
501
|
hasScroller = this.get('hasVerticalScroller');
|
518
|
-
vscroll = hasScroller ? this.get('verticalScrollerView') : null
|
519
|
-
vscroll2 = hasScroller ? this.get('verticalScrollerView2') : null
|
520
|
-
hasVertical = vscroll && this.get('isVerticalScrollerVisible')
|
502
|
+
vscroll = hasScroller ? this.get('verticalScrollerView') : null;
|
503
|
+
vscroll2 = hasScroller ? this.get('verticalScrollerView2') : null;
|
504
|
+
hasVertical = vscroll && this.get('isVerticalScrollerVisible');
|
521
505
|
|
522
506
|
// get the containerView
|
523
|
-
clip = this.get('containerView')
|
524
|
-
clipLayout = { left: 0, top: 0 }
|
507
|
+
clip = this.get('containerView');
|
508
|
+
clipLayout = { left: 0, top: 0 };
|
525
509
|
|
526
510
|
if (hasVertical) {
|
527
|
-
viewportHeight =0;
|
511
|
+
viewportHeight = 0;
|
528
512
|
var scrollerThickness = vscroll.get('scrollerThickness') || vscroll2.get('scrollerThickness');
|
529
|
-
var view = this.get('contentView'),
|
513
|
+
var view = this.get('contentView'),
|
530
514
|
f = (view) ? view.get('frame') : null,
|
531
515
|
height = (f) ? f.height : 0,
|
532
516
|
elem = this.containerView.$()[0],
|
@@ -536,36 +520,38 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
536
520
|
bottomArrowVisible = { height: scrollerThickness, bottom: 0, right: 0, left: 0 },
|
537
521
|
bottomArrowInvisible = { height: 0, bottom: 0, right: 0, left: 0 };
|
538
522
|
|
539
|
-
if(elem) viewportHeight = elem.offsetHeight;
|
523
|
+
if (elem) viewportHeight = elem.offsetHeight;
|
540
524
|
|
541
|
-
if(verticalOffset===0){
|
542
|
-
clipLayout.top = 0
|
525
|
+
if (verticalOffset === 0) {
|
526
|
+
clipLayout.top = 0;
|
543
527
|
clipLayout.bottom = scrollerThickness;
|
544
|
-
vscroll.set('layout', topArrowInvisible)
|
545
|
-
vscroll2.set('layout', bottomArrowVisible)
|
546
|
-
}else if(verticalOffset>=(height-viewportHeight-scrollerThickness)){
|
547
|
-
clipLayout.top = scrollerThickness
|
548
|
-
clipLayout.bottom = 0
|
549
|
-
vscroll.set('layout', topArrowVisible)
|
550
|
-
vscroll2.set('layout', bottomArrowInvisible)
|
551
|
-
}else{
|
552
|
-
clipLayout.top = scrollerThickness
|
553
|
-
clipLayout.bottom = scrollerThickness
|
554
|
-
vscroll.set('layout', topArrowVisible)
|
555
|
-
vscroll2.set('layout', bottomArrowVisible)
|
528
|
+
vscroll.set('layout', topArrowInvisible);
|
529
|
+
vscroll2.set('layout', bottomArrowVisible);
|
530
|
+
} else if (verticalOffset >= (height - viewportHeight - scrollerThickness)) {
|
531
|
+
clipLayout.top = scrollerThickness;
|
532
|
+
clipLayout.bottom = 0;
|
533
|
+
vscroll.set('layout', topArrowVisible);
|
534
|
+
vscroll2.set('layout', bottomArrowInvisible);
|
535
|
+
} else {
|
536
|
+
clipLayout.top = scrollerThickness;
|
537
|
+
clipLayout.bottom = scrollerThickness;
|
538
|
+
vscroll.set('layout', topArrowVisible);
|
539
|
+
vscroll2.set('layout', bottomArrowVisible);
|
556
540
|
}
|
557
541
|
}
|
558
|
-
|
559
|
-
|
560
|
-
|
542
|
+
|
543
|
+
if (vscroll) {
|
544
|
+
vscroll.set('isVisible', hasVertical);
|
545
|
+
vscroll2.set('isVisible', hasVertical);
|
561
546
|
}
|
562
|
-
|
547
|
+
|
548
|
+
clip.set('layout', clipLayout);
|
563
549
|
},
|
564
550
|
|
565
551
|
/** @private
|
566
552
|
Called whenever a scroller visibility changes. Calls the tile() method.
|
567
553
|
*/
|
568
|
-
scrollerVisibilityDidChange: function() {
|
554
|
+
scrollerVisibilityDidChange: function () {
|
569
555
|
this.tile();
|
570
556
|
}.observes('isVerticalScrollerVisible', 'isHorizontalScrollerVisible', 'verticalScrollOffset'),
|
571
557
|
|
@@ -578,8 +564,8 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
578
564
|
Instantiate scrollers & container views as needed. Replace their classes
|
579
565
|
in the regular properties.
|
580
566
|
*/
|
581
|
-
createChildViews: function() {
|
582
|
-
var childViews = [], view, view2, controlSize = this.get('controlSize')
|
567
|
+
createChildViews: function () {
|
568
|
+
var childViews = [], view, view2, controlSize = this.get('controlSize');
|
583
569
|
|
584
570
|
// create the containerView. We must always have a container view.
|
585
571
|
// also, setup the contentView as the child of the containerView...
|
@@ -593,53 +579,53 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
593
579
|
this.contentView = this.containerView.get('contentView');
|
594
580
|
|
595
581
|
// create a vertical scroller
|
596
|
-
if ((view=this.verticalScrollerView) && (view2=this.verticalScrollerView2)) {
|
582
|
+
if ((view = this.verticalScrollerView) && (view2 = this.verticalScrollerView2)) {
|
597
583
|
if (this.get('hasVerticalScroller')) {
|
598
584
|
view = this.verticalScrollerView = this.createChildView(view, {
|
599
585
|
layout: {top: 0, left: 0, right: 0},
|
600
586
|
controlSize: controlSize,
|
601
587
|
valueBinding: '*owner.verticalScrollOffset'
|
602
|
-
})
|
588
|
+
});
|
603
589
|
childViews.push(view);
|
604
590
|
view2 = this.verticalScrollerView2 = this.createChildView(view2, {
|
605
591
|
scrollDown: YES,
|
606
|
-
layout: {bottom: 0, left: 0, right: 0 },
|
592
|
+
layout: { bottom: 0, left: 0, right: 0 },
|
607
593
|
controlSize: controlSize,
|
608
594
|
valueBinding: '*owner.verticalScrollOffset'
|
609
|
-
})
|
595
|
+
});
|
610
596
|
childViews.push(view2);
|
611
597
|
} else {
|
612
|
-
this.verticalScrollerView = null
|
613
|
-
this.verticalScrollerView2 = null
|
598
|
+
this.verticalScrollerView = null;
|
599
|
+
this.verticalScrollerView2 = null;
|
614
600
|
}
|
615
601
|
}
|
616
602
|
|
617
603
|
// set childViews array.
|
618
|
-
this.childViews = childViews
|
604
|
+
this.childViews = childViews;
|
619
605
|
|
620
|
-
this.contentViewFrameDidChange()
|
621
|
-
this.tile()
|
606
|
+
this.contentViewFrameDidChange(); // setup initial display...
|
607
|
+
this.tile(); // set up initial tiling
|
622
608
|
},
|
623
609
|
|
624
610
|
/** @private */
|
625
|
-
init: function() {
|
611
|
+
init: function () {
|
626
612
|
sc_super();
|
627
613
|
|
628
614
|
// start observing initial content view. The content view's frame has
|
629
615
|
// already been setup in prepareDisplay so we don't need to call
|
630
616
|
// viewFrameDidChange...
|
631
|
-
this._scroll_contentView = this.get('contentView')
|
632
|
-
var contentView = this._scroll_contentView
|
617
|
+
this._scroll_contentView = this.get('contentView');
|
618
|
+
var contentView = this._scroll_contentView;
|
633
619
|
|
634
620
|
if (contentView) {
|
635
|
-
contentView.addObserver('frame', this, this.contentViewFrameDidChange)
|
621
|
+
contentView.addObserver('frame', this, this.contentViewFrameDidChange);
|
636
622
|
}
|
637
623
|
|
638
|
-
if (this.get('isVisibleInWindow')) this._scsv_registerAutoscroll()
|
624
|
+
if (this.get('isVisibleInWindow')) this._scsv_registerAutoscroll();
|
639
625
|
},
|
640
626
|
|
641
627
|
/** @private Registers/deregisters view with SC.Drag for autoscrolling */
|
642
|
-
_scsv_registerAutoscroll: function() {
|
628
|
+
_scsv_registerAutoscroll: function () {
|
643
629
|
if (this.get('isVisibleInWindow')) SC.Drag.addScrollableView(this);
|
644
630
|
else SC.Drag.removeScrollableView(this);
|
645
631
|
}.observes('isVisibleInWindow'),
|
@@ -650,32 +636,32 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
650
636
|
size of the contentView changes. We don't care about the origin since
|
651
637
|
that is tracked separately from the offset values.
|
652
638
|
*/
|
653
|
-
contentViewFrameDidChange: function() {
|
639
|
+
contentViewFrameDidChange: function () {
|
654
640
|
var view = this.get('contentView'), view2,
|
655
641
|
f = (view) ? view.get('frame') : null,
|
656
642
|
width = (f) ? f.width : 0,
|
657
643
|
height = (f) ? f.height : 0,
|
658
644
|
dim = this.get('frame'),
|
659
|
-
viewportHeight, elem
|
645
|
+
viewportHeight, elem;
|
660
646
|
|
661
647
|
// cache out scroll settings...
|
662
|
-
//if ((width === this._scroll_contentWidth) && (height === this._scroll_contentHeight)) return
|
648
|
+
//if ((width === this._scroll_contentWidth) && (height === this._scroll_contentHeight)) return;
|
663
649
|
this._scroll_contentWidth = width;
|
664
|
-
this._scroll_contentHeight = height
|
650
|
+
this._scroll_contentHeight = height;
|
665
651
|
|
666
652
|
if (this.get('hasVerticalScroller') && (view = this.get('verticalScrollerView')) && (view2 = this.get('verticalScrollerView2'))) {
|
667
|
-
height -= 1
|
653
|
+
height -= 1; // accurately account for our layout
|
668
654
|
// decide if it should be visible or not
|
669
655
|
if (this.get('autohidesVerticalScroller')) {
|
670
656
|
this.set('isVerticalScrollerVisible', height > dim.height);
|
671
657
|
}
|
672
|
-
height -= this.get('verticalScrollerBottom')
|
658
|
+
height -= this.get('verticalScrollerBottom');
|
673
659
|
viewportHeight = 0;
|
674
660
|
elem = this.containerView.$()[0];
|
675
|
-
if(elem) viewportHeight = elem.offsetHeight;
|
661
|
+
if (elem) viewportHeight = elem.offsetHeight;
|
676
662
|
height = height - viewportHeight;
|
677
|
-
view.setIfChanged('maximum', height)
|
678
|
-
view2.setIfChanged('maximum', height)
|
663
|
+
view.setIfChanged('maximum', height);
|
664
|
+
view2.setIfChanged('maximum', height);
|
679
665
|
}
|
680
666
|
},
|
681
667
|
|
@@ -683,18 +669,18 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
683
669
|
Whenever the horizontal scroll offset changes, update the scrollers and
|
684
670
|
edit the location of the contentView.
|
685
671
|
*/
|
686
|
-
_scroll_horizontalScrollOffsetDidChange: function() {},
|
672
|
+
_scroll_horizontalScrollOffsetDidChange: function () {},
|
687
673
|
|
688
674
|
/** @private
|
689
675
|
Whenever the vertical scroll offset changes, update the scrollers and
|
690
676
|
edit the location of the contentView.
|
691
677
|
*/
|
692
|
-
_scroll_verticalScrollOffsetDidChange: function() {
|
693
|
-
var offset = this.get('verticalScrollOffset')
|
678
|
+
_scroll_verticalScrollOffsetDidChange: function () {
|
679
|
+
var offset = this.get('verticalScrollOffset');
|
694
680
|
|
695
681
|
// update the offset for the contentView...
|
696
682
|
var contentView = this.get('contentView');
|
697
|
-
if (contentView) contentView.$().css('top', (0-offset) + "px");
|
683
|
+
if (contentView) contentView.$().css('top', (0 - offset) + "px");
|
698
684
|
|
699
685
|
}.observes('verticalScrollOffset')
|
700
686
|
|