Skip to content

Commit 06f203a

Browse files
authored
Merge branch 'master' into ddimitrov/IgxTreeGrid
2 parents e29ebdd + bf7c69e commit 06f203a

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

projects/igniteui-angular/src/lib/directives/for-of/display.container.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ import {
88

99
@Component({
1010
selector: 'igx-display-container',
11-
template: '<ng-template #display_container igxScrollInertia [IgxScrollInertiaScrollContainer]="scrollContainer"></ng-template>'
11+
template: `
12+
<ng-template
13+
#display_container
14+
igxScrollInertia
15+
[IgxScrollInertiaScrollContainer]="scrollContainer"
16+
[IgxScrollInertiaDirection]="scrollDirection">
17+
</ng-template>
18+
`
1219
})
1320
export class DisplayContainerComponent {
1421
@ViewChild('display_container', { read: ViewContainerRef })
1522
public _vcr;
1623

24+
public scrollDirection: string;
25+
1726
@HostBinding('class')
1827
public cssClass = 'igx-display-container';
1928

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
252252

253253
const dcFactory: ComponentFactory<DisplayContainerComponent> = this.resolver.resolveComponentFactory(DisplayContainerComponent);
254254
this.dc = this._viewContainer.createComponent(dcFactory, 0);
255+
this.dc.instance.scrollDirection = this.igxForScrollOrientation;
255256
if (typeof MSGesture === 'function') {
256257
// On Edge and IE when scrolling on touch the page scroll instead of the grid.
257258
this.dc.instance._viewContainer.element.nativeElement.style.touchAction = 'none';

projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('Scroll Inertia Directive ', () => {
5151

5252
// Unit test for wheel - wheelDelataY/wheelDeltaX supported on Chrome, Safari, Opera.
5353
it('should change scroll top for related scrollbar if onWheel is executed with wheelDeltaY.', () => {
54+
fix.componentInstance.scrInertiaDir.IgxScrollInertiaDirection = 'vertical';
5455
const scrInertiaDir = fix.componentInstance.scrInertiaDir;
5556
const evt = {wheelDeltaY: -240, preventDefault: () => {}};
5657
scrInertiaDir.onWheel(evt);
@@ -61,6 +62,7 @@ describe('Scroll Inertia Directive ', () => {
6162

6263
it('should change scroll left for related scrollbar if onWheel is executed with wheelDeltaX.', () => {
6364
const scrInertiaDir = fix.componentInstance.scrInertiaDir;
65+
fix.componentInstance.scrInertiaDir.IgxScrollInertiaDirection = 'horizontal';
6466
const evt = {wheelDeltaX: -240, preventDefault: () => {}};
6567
scrInertiaDir.onWheel(evt);
6668

@@ -71,6 +73,7 @@ describe('Scroll Inertia Directive ', () => {
7173
// Unit tests for wheel on other browsers that don't provide wheelDelta - use deltaX and deltaY.
7274
it('should change scroll top for related scrollbar if onWheel is executed with deltaY.', () => {
7375
const scrInertiaDir = fix.componentInstance.scrInertiaDir;
76+
fix.componentInstance.scrInertiaDir.IgxScrollInertiaDirection = 'vertical';
7477
const evt = {deltaY: 1, preventDefault: () => {}};
7578
scrInertiaDir.onWheel(evt);
7679

@@ -80,6 +83,7 @@ describe('Scroll Inertia Directive ', () => {
8083

8184
it('should change scroll left for related scrollbar if onWheel is executed with deltaX.', () => {
8285
const scrInertiaDir = fix.componentInstance.scrInertiaDir;
86+
fix.componentInstance.scrInertiaDir.IgxScrollInertiaDirection = 'horizontal';
8387
const evt = {deltaX: 1, preventDefault: () => {}};
8488
scrInertiaDir.onWheel(evt);
8589

projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
88

99
}
1010

11+
@Input()
12+
public IgxScrollInertiaDirection: string;
13+
1114
@Input()
1215
public IgxScrollInertiaScrollContainer: any;
1316

@@ -121,7 +124,7 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
121124
/* For other browsers that don't provide wheelDelta, use the deltaY to determine direction and pass default values. */
122125
scrollDeltaY = this.calcAxisCoords(evt.deltaY, -1, 1);
123126
}
124-
if (scrollDeltaX) {
127+
if (scrollDeltaX && this.IgxScrollInertiaDirection === 'horizontal') {
125128
this._scrollToX(
126129
this._startX + scrollDeltaX * scrollStep
127130
);
@@ -131,7 +134,7 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
131134
// Prevent navigating through pages when scrolling on Mac
132135
evt.preventDefault();
133136
}
134-
} else if (scrollDeltaY) {
137+
} else if (scrollDeltaY && this.IgxScrollInertiaDirection === 'vertical') {
135138
this._scrollToY(
136139
this._startY + scrollDeltaY * scrollStep
137140
);

0 commit comments

Comments
 (0)