mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
refactor(angular): gesture controller uses correct core instance (#28477)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `GestureController` provider does not use the correct underlying instance of the utilities from either the lazy or custom elements build, depending on if the developer is using `@ionic/angular` or `@ionic/angular/standalone`. It will always use the lazy instance. This applied to the `createGesture` function. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `GestureController` uses the instance of the utilities based on it's implementation type, e.g. `@ionic/angular/standalone` uses the custom elements build with the utilities from `@ionic/core/components`. - `@ionic/angular` and `@ionic/angular/standalone` now export their own specific implementation of `GestureController` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
import { NgZone, Injectable } from '@angular/core';
|
||||
import type { Gesture, GestureConfig } from '@ionic/core/components';
|
||||
import { createGesture } from '@ionic/core/components';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GestureController {
|
||||
constructor(private zone: NgZone) {}
|
||||
/**
|
||||
* Create a new gesture
|
||||
*/
|
||||
create(opts: GestureConfig, runInsideAngularZone = false): Gesture {
|
||||
if (runInsideAngularZone) {
|
||||
Object.getOwnPropertyNames(opts).forEach((key) => {
|
||||
if (typeof opts[key] === 'function') {
|
||||
const fn = opts[key];
|
||||
opts[key] = (...props: any[]) => this.zone.run(() => fn(...props));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return createGesture(opts);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user