Skip to content

Commit 3250d10

Browse files
committed
fix(scrollView): on desktop, mousewheel only scrolls the right scrollView
Closes #1376
1 parent 4a21013 commit 3250d10

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

Diff for: js/angular/directive/content.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function($timeout, $controller, $ionicBind) {
4747
compile: function(element, attr) {
4848
var innerElement;
4949

50-
element.addClass('scroll-content');
50+
element.addClass('scroll-content ionic-scroll');
5151

5252
if (attr.scroll != 'false') {
5353
//We cannot use normal transclude here because it breaks element.data()

Diff for: js/angular/directive/scroll.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function($timeout, $controller, $ionicBind) {
3131
scope: true,
3232
controller: function() {},
3333
compile: function(element, attr) {
34-
element.addClass('scroll-view');
34+
element.addClass('scroll-view ionic-scroll');
3535

3636
//We cannot transclude here because it breaks element.data() inheritance on compile
3737
var innerElement = jqLite('<div class="scroll"></div>');

Diff for: js/utils/dom.js

-11
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,6 @@
250250
return null;
251251
},
252252

253-
elementHasParent: function(element, parent) {
254-
var current = element;
255-
while (current) {
256-
if (current.parentNode === parent) {
257-
return true;
258-
}
259-
current = current.parentNode;
260-
}
261-
return false;
262-
},
263-
264253
/**
265254
* @ngdoc method
266255
* @name ionic.DomUtil#rectContains

Diff for: js/views/scrollView.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -838,12 +838,15 @@ ionic.views.Scroll = ionic.views.View.inherit({
838838
};
839839

840840
self.mouseWheel = ionic.animationFrameThrottle(function(e) {
841-
if (ionic.DomUtil.elementHasParent(e.target, self.__container)) {
841+
var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');
842+
if (scrollParent === self.__container) {
843+
842844
self.hintResize();
843845
self.scrollBy(
844846
e.wheelDeltaX/self.options.wheelDampen,
845847
-e.wheelDeltaY/self.options.wheelDampen
846848
);
849+
847850
self.__fadeScrollbars('in');
848851
clearTimeout(self.__wheelHideBarTimeout);
849852
self.__wheelHideBarTimeout = setTimeout(function() {

0 commit comments

Comments
 (0)