refactor: circular deps part 4

This commit is contained in:
Nathan Walker
2025-07-08 07:27:43 -07:00
parent 1fdc933d8f
commit 4285a33d8f
9 changed files with 53 additions and 34 deletions

View File

@@ -691,7 +691,7 @@ class CustomRotateGestureDetector {
}
}
class Pointer implements Pointer {
class Pointer {
public android: number;
public ios: any = undefined;
@@ -711,7 +711,7 @@ class Pointer implements Pointer {
}
}
class TouchGestureEventData implements TouchGestureEventData {
export class TouchGestureEventData {
eventName: string = toString(GestureTypes.touch);
type: GestureTypes = GestureTypes.touch;
ios: any = undefined;

View File

@@ -1,8 +1,9 @@
import type { View } from '../core/view';
import { GestureEventData, GestureTypes } from './gestures-types';
export * from './gestures-common';
export * from './touch-manager';
export type { GesturesObserverDefinition } from './gestures-types';
export * from './gestures-types';
/**
* Provides options for the GesturesObserver.
@@ -50,6 +51,39 @@ export class GesturesObserver {
androidOnTouchEvent: (motionEvent: any /* android.view.MotionEvent */) => void;
}
class Pointer {
android: any;
ios: UITouch;
get location();
getX(): number;
getY(): number;
}
export class TouchGestureEventData {
eventName: string;
type: GestureTypes;
ios: any;
action: string;
view: View;
android: android.view.MotionEvent;
object: any;
prepare(view: View, e: any): void;
getPointerCount(): number;
getActivePointers(): Array<Pointer>;
getAllPointers(): Array<Pointer>;
getX(): number;
getY(): number;
}
/**
* A short-hand function that is used to create a gesture observer for a view and gesture.
* @param target - View which will be watched for originating a specific gesture.

View File

@@ -1,15 +1,8 @@
// Definitions.
import { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from '.';
import type { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from './gestures-types';
import type { View } from '../core/view';
import { EventData } from '../../data/observable';
// Types.
import { GesturesObserverBase, toString, TouchAction, GestureStateTypes, GestureTypes, SwipeDirection, GestureEvents } from './gestures-common';
// Import layout from utils directly to avoid circular references
import { layout } from '../../utils';
export * from './gestures-common';
export * from './gestures-types';
export * from './touch-manager';
@@ -541,7 +534,7 @@ class TouchGestureRecognizer extends UIGestureRecognizer {
}
}
class Pointer implements Pointer {
class Pointer {
public android: any = undefined;
public ios: UITouch = undefined;
@@ -571,7 +564,7 @@ class Pointer implements Pointer {
}
}
class TouchGestureEventData implements TouchGestureEventData {
export class TouchGestureEventData {
eventName: string = toString(GestureTypes.touch);
type: GestureTypes = GestureTypes.touch;
android: any = undefined;

View File

@@ -1,7 +0,0 @@
export * from './index.android';
export * from './gestures-common';
export * from './gestures-types';
export * from './touch-manager';
export { GesturesObserver, observe } from './index.android';
export { TouchManager, TouchAnimationOptions, VisionHoverOptions } from './touch-manager';

View File

@@ -2,12 +2,12 @@
* Provides various helpers for adding easy touch handling animations.
* Use when needing to implement more interactivity with your UI regarding touch down/up behavior.
*/
import type { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types';
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-types';
import { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types';
import { Animation } from '../animation';
import { AnimationDefinition } from '../animation/animation-interfaces';
import type { View } from '../core/view';
import { isObject, isFunction } from '../../utils/types';
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-common';
export type TouchAnimationFn = (view: View) => void;
export type TouchAnimationOptions = {