Skip to content

Commit 3e4d6b0

Browse files
authored
fix(grid-item): touch-action should be set to auto when grid item isn't draggable (#131)
1 parent da7a9a6 commit 3e4d6b0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/angular-grid-layout/src/lib/grid-item/grid-item.component.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
position: absolute;
55
z-index: 1;
66
overflow: hidden;
7-
touch-action: none;
87

98
div {
109
position: absolute;

projects/angular-grid-layout/src/lib/grid-item/grid-item.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, ContentChildren, ElementRef, Inject, Input, NgZone, OnDestroy, OnInit,
2+
AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, ContentChildren, ElementRef, HostBinding, Inject, Input, NgZone, OnDestroy, OnInit,
33
QueryList, Renderer2, ViewChild
44
} from '@angular/core';
55
import { BehaviorSubject, NEVER, Observable, Subject, Subscription, iif, merge } from 'rxjs';
@@ -39,6 +39,11 @@ export class KtdGridItemComponent implements OnInit, OnDestroy, AfterContentInit
3939
/** CSS transition style. Note that for more performance is preferable only make transition on transform property. */
4040
@Input() transition: string = 'transform 500ms ease, width 500ms ease, height 500ms ease';
4141

42+
/** Dynamically apply `touch-action` to the host element based on draggable */
43+
@HostBinding('style.touch-action') get touchAction(): string {
44+
return this._draggable ? 'none' : 'auto';
45+
}
46+
4247
dragStart$: Observable<MouseEvent | TouchEvent>;
4348
resizeStart$: Observable<MouseEvent | TouchEvent>;
4449

0 commit comments

Comments
 (0)