Closed f3l1xss closed 4 years ago
I have this in my Angular 9 code and it's swiping:
import 'hammerjs';
import { HammerModule } from '@angular/platform-browser';
import {
HammerGestureConfig,
HAMMER_GESTURE_CONFIG
} from '@angular/platform-browser';
export class MyHammerConfig extends HammerGestureConfig {
overrides = {
pinch: { enable: false },
rotate: { enable: false } as any
};
}
@windcloak I have already had that but still it wont swipe, by swiping I meant swiping with finger at touch screen:)
I have already put above configuration at my app.module.ts providers list: providers: [ { provide: HAMMER_GESTURE_CONFIG, useClass: CustomHammerConfig }, { provide: HTTP_INTERCEPTORS, useClass: AjaxHeaderInterceptor, multi: true } ],
Are you able to post your app.module config? and the gallery config too perhaps? Thank you
Have spent half day to resolve this turns out its just one line fix to import HammerModule as described here:
https://github.com/angular/angular/pull/32203
By default Ivy (Angular 9) will NO longer include HammerSupport and thereby we have to import it manually at root.
@windcloak Thank you, had to went through your code to find out, I like your cosplay:)
And its no longer neccessary to create custom config like this: providers: [ { provide: HAMMER_GESTURE_CONFIG, useClass: CustomHammerConfig }, { provide: HTTP_INTERCEPTORS, useClass: AjaxHeaderInterceptor, multi: true } ],
as well as to include hammer.js script at angular.json, swiping will work just by importing HammerModule
@f3l1xss Neat, I'll have to clean that up. Less code to mess with is definitely better.
Hi, previously using ngx-gallery here. After I updated my apps to Angular 9, swiping doesn't seem to work anymore.
I have tried adding this class to my app module config:
export class CustomHammerConfig extends HammerGestureConfig { overrides = { pinch: { enable: false }, rotate: { enable: false }, }; }
but doesn't seem to work either