Skip to content

Commit 1d571b2

Browse files
JiaLiPassionmatsko
authored andcommitted
feat(platform-browser): fix #19604, can config hammerOptions (#21979)
PR Close #21979
1 parent 3a0b5a9 commit 1d571b2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/platform-browser/src/dom/events/hammer_gestures.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,17 @@ export class HammerGestureConfig {
7272

7373
overrides: {[key: string]: Object} = {};
7474

75+
options?: {
76+
cssProps?: any; domEvents?: boolean; enable?: boolean | ((manager: any) => boolean);
77+
preset?: any[];
78+
touchAction?: string;
79+
recognizers?: any[];
80+
inputClass?: any;
81+
inputTarget?: EventTarget;
82+
};
83+
7584
buildHammer(element: HTMLElement): HammerInstance {
76-
const mc = new Hammer(element);
85+
const mc = new Hammer(element, this.options);
7786

7887
mc.get('pinch').set({enable: true});
7988
mc.get('rotate').set({enable: true});

tools/public_api_guard/platform-browser/platform-browser.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ export declare const HAMMER_GESTURE_CONFIG: InjectionToken<HammerGestureConfig>;
5353
/** @experimental */
5454
export declare class HammerGestureConfig {
5555
events: string[];
56+
options?: {
57+
cssProps?: any;
58+
domEvents?: boolean;
59+
enable?: boolean | ((manager: any) => boolean);
60+
preset?: any[];
61+
touchAction?: string;
62+
recognizers?: any[];
63+
inputClass?: any;
64+
inputTarget?: EventTarget;
65+
};
5666
overrides: {
5767
[key: string]: Object;
5868
};

0 commit comments

Comments
 (0)