-
-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove circular dependencies on web (#2783)
## Description While working on problems with scroll we discovered that Gesture Handler has many circular dependencies. This PR removes them from web implementation (the only one that's left is related to `hammer`). It also adds `madge` - tool to find circular dependencies in our project. ## Test plan Run `yarn madge --extensions js,ts,tsx --circular src | grep web` from root.
- Loading branch information
Showing
19 changed files
with
819 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Gesture Handlers | ||
import PanGestureHandler from './handlers/PanGestureHandler'; | ||
import TapGestureHandler from './handlers/TapGestureHandler'; | ||
import LongPressGestureHandler from './handlers/LongPressGestureHandler'; | ||
import PinchGestureHandler from './handlers/PinchGestureHandler'; | ||
import RotationGestureHandler from './handlers/RotationGestureHandler'; | ||
import FlingGestureHandler from './handlers/FlingGestureHandler'; | ||
import NativeViewGestureHandler from './handlers/NativeViewGestureHandler'; | ||
import ManualGestureHandler from './handlers/ManualGestureHandler'; | ||
import HoverGestureHandler from './handlers/HoverGestureHandler'; | ||
|
||
//Hammer Handlers | ||
import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler'; | ||
import HammerPanGestureHandler from '../web_hammer/PanGestureHandler'; | ||
import HammerTapGestureHandler from '../web_hammer/TapGestureHandler'; | ||
import HammerLongPressGestureHandler from '../web_hammer/LongPressGestureHandler'; | ||
import HammerPinchGestureHandler from '../web_hammer/PinchGestureHandler'; | ||
import HammerRotationGestureHandler from '../web_hammer/RotationGestureHandler'; | ||
import HammerFlingGestureHandler from '../web_hammer/FlingGestureHandler'; | ||
|
||
export const Gestures = { | ||
NativeViewGestureHandler, | ||
PanGestureHandler, | ||
TapGestureHandler, | ||
LongPressGestureHandler, | ||
PinchGestureHandler, | ||
RotationGestureHandler, | ||
FlingGestureHandler, | ||
ManualGestureHandler, | ||
HoverGestureHandler, | ||
}; | ||
|
||
export const HammerGestures = { | ||
NativeViewGestureHandler: HammerNativeViewGestureHandler, | ||
PanGestureHandler: HammerPanGestureHandler, | ||
TapGestureHandler: HammerTapGestureHandler, | ||
LongPressGestureHandler: HammerLongPressGestureHandler, | ||
PinchGestureHandler: HammerPinchGestureHandler, | ||
RotationGestureHandler: HammerRotationGestureHandler, | ||
FlingGestureHandler: HammerFlingGestureHandler, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { PointerType } from '../../PointerType'; | ||
import type { MouseButton } from '../../handlers/gestureHandlerCommon'; | ||
import type { State } from '../../State'; | ||
import type { Config } from '../interfaces'; | ||
import type EventManager from '../tools/EventManager'; | ||
import type { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate'; | ||
import type PointerTracker from '../tools/PointerTracker'; | ||
|
||
export default interface IGestureHandler { | ||
getTag: () => number; | ||
getState: () => State; | ||
getConfig: () => Config; | ||
getDelegate: () => GestureHandlerDelegate<unknown, this>; | ||
|
||
attachEventManager: (manager: EventManager<unknown>) => void; | ||
|
||
isButtonInConfig: ( | ||
mouseButton: MouseButton | undefined | ||
) => boolean | number | undefined; | ||
getPointerType: () => PointerType; | ||
|
||
getTracker: () => PointerTracker; | ||
getTrackedPointersID: () => number[]; | ||
|
||
begin: () => void; | ||
activate: () => void; | ||
end: () => void; | ||
fail: () => void; | ||
cancel: () => void; | ||
|
||
reset: () => void; | ||
isEnabled: () => boolean; | ||
isActive: () => boolean; | ||
setActive: (value: boolean) => void; | ||
isAwaiting: () => boolean; | ||
setAwaiting: (value: boolean) => void; | ||
setActivationIndex: (value: number) => void; | ||
setShouldResetProgress: (value: boolean) => void; | ||
|
||
shouldWaitForHandlerFailure: (handler: IGestureHandler) => boolean; | ||
shouldRequireToWaitForFailure: (handler: IGestureHandler) => boolean; | ||
shouldRecognizeSimultaneously: (handler: IGestureHandler) => boolean; | ||
shouldBeCancelledByOther: (handler: IGestureHandler) => boolean; | ||
|
||
sendEvent: (newState: State, oldState: State) => void; | ||
|
||
updateGestureConfig: (config: Config) => void; | ||
|
||
isButton?: () => boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.