@react-native-oh-tpl/react-native-gesture-handler 2.12.9-1 → 2.14.1-2.14.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/DrawerLayout/index.ts +2 -0
  2. package/Swipeable/index.ts +2 -0
  3. package/harmony/gesture_handler/BuildProfile.ets +15 -4
  4. package/harmony/gesture_handler/hvigorfile.ts +1 -1
  5. package/harmony/gesture_handler/index.ets +2 -2
  6. package/harmony/gesture_handler/oh-package-lock.json5 +4 -4
  7. package/harmony/gesture_handler/oh-package.json5 +4 -4
  8. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +64 -18
  9. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +3 -3
  10. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +2 -2
  11. package/harmony/gesture_handler/src/main/cpp/{RNGestureHandlerButtonComponentInstance.h → componentInstances/RNGestureHandlerButtonComponentInstance.h} +2 -2
  12. package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +242 -0
  13. package/harmony/gesture_handler/src/main/ets/{GestureHandler.ts → core/GestureHandler.ts} +46 -25
  14. package/harmony/gesture_handler/src/main/ets/{GestureHandlerOrchestrator.ts → core/GestureHandlerOrchestrator.ts} +122 -67
  15. package/harmony/gesture_handler/src/main/ets/{GestureHandlerRegistry.ts → core/GestureHandlerRegistry.ts} +7 -0
  16. package/harmony/gesture_handler/src/main/ets/{Event.ts → core/IncomingEvent.ts} +30 -20
  17. package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +144 -0
  18. package/harmony/gesture_handler/src/main/ets/{OutgoingEvent.ts → core/OutgoingEvent.ts} +1 -1
  19. package/harmony/gesture_handler/src/main/ets/core/OutgoingEventDispatcher.ts +12 -0
  20. package/harmony/gesture_handler/src/main/ets/{PointerTracker.ts → core/PointerTracker.ts} +4 -4
  21. package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +12 -0
  22. package/harmony/gesture_handler/src/main/ets/core/Vector2D.ts +80 -0
  23. package/harmony/gesture_handler/src/main/ets/{VelocityTracker.ts → core/VelocityTracker.ts} +13 -5
  24. package/harmony/gesture_handler/src/main/ets/core/View.ts +21 -0
  25. package/harmony/gesture_handler/src/main/ets/core/index.ts +13 -0
  26. package/harmony/gesture_handler/src/main/ets/detectors/ScaleGestureDetector.ts +169 -0
  27. package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +211 -0
  28. package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +64 -0
  29. package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +127 -0
  30. package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +42 -0
  31. package/harmony/gesture_handler/src/main/ets/{NativeViewGestureHandler.ts → gesture-handlers/NativeViewGestureHandler.ts} +15 -15
  32. package/harmony/gesture_handler/src/main/ets/{PanGestureHandler.ts → gesture-handlers/PanGestureHandler.ts} +27 -13
  33. package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +159 -0
  34. package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +164 -0
  35. package/harmony/gesture_handler/src/main/ets/{TapGestureHandler.ts → gesture-handlers/TapGestureHandler.ts} +11 -11
  36. package/harmony/gesture_handler/src/main/ets/gesture-handlers/detectors/RotationGestureDetector.ts +167 -0
  37. package/harmony/gesture_handler/src/main/ets/gesture-handlers/index.ts +1 -0
  38. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +8 -9
  39. package/harmony/gesture_handler/src/main/ets/namespace/{RNGestureHandlerButton.ts → components/RNGestureHandlerButton.ts} +35 -36
  40. package/harmony/gesture_handler/src/main/ets/namespace/{RNGestureHandlerRootView.ts → components/RNGestureHandlerRootView.ts} +23 -23
  41. package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +2 -0
  42. package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +2 -3
  43. package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerArkUIAdapter.ts +240 -0
  44. package/harmony/gesture_handler/src/main/ets/{GestureHandlerPackage.ts → rnoh/GestureHandlerPackage.ts} +4 -4
  45. package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +49 -0
  46. package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +71 -0
  47. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +108 -0
  48. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +110 -0
  49. package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerButton.ets → rnoh/RNGestureHandlerButton.ets} +3 -3
  50. package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerModule.ts → rnoh/RNGestureHandlerModule.ts} +76 -27
  51. package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerRootView.ets → rnoh/RNGestureHandlerRootView.ets} +3 -3
  52. package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +24 -0
  53. package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +32 -0
  54. package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +134 -0
  55. package/harmony/gesture_handler/src/main/ets/rnoh/ViewRegistry.ts +95 -0
  56. package/harmony/gesture_handler/src/main/module.json5 +8 -6
  57. package/harmony/gesture_handler/ts.ts +2 -2
  58. package/harmony/gesture_handler.har +0 -0
  59. package/lib/commonjs/index.js +126 -141
  60. package/lib/commonjs/index.js.map +1 -1
  61. package/lib/module/index.js +13 -146
  62. package/lib/module/index.js.map +1 -1
  63. package/lib/typescript/index.d.ts +39 -1
  64. package/lib/typescript/index.d.ts.map +1 -1
  65. package/package.json +13 -10
  66. package/src/index.ts +140 -140
  67. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +0 -72
  68. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +0 -123
  69. package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +0 -53
  70. package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ts +0 -203
  71. package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +0 -45
  72. package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +0 -109
  73. package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +0 -48
  74. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerArkTS.ts +0 -60
  75. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +0 -87
  76. package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +0 -23
  77. package/harmony/gesture_handler/src/main/ets/Vector2D.ts +0 -36
  78. package/harmony/gesture_handler/src/main/ets/View.ts +0 -71
  79. package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +0 -43
  80. package/harmony/gesture_handler/src/main/ets/pages/Index.ets +0 -17
  81. package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +0 -41
  82. /package/harmony/gesture_handler/src/main/ets/{CircularBuffer.ts → core/CircularBuffer.ts} +0 -0
  83. /package/harmony/gesture_handler/src/main/ets/{LeastSquareSolver.ts → core/LeastSquareSolver.ts} +0 -0
  84. /package/harmony/gesture_handler/src/main/ets/{RNGHError.ts → core/RNGHError.ts} +0 -0
  85. /package/harmony/gesture_handler/src/main/ets/{State.ts → core/State.ts} +0 -0
  86. /package/harmony/gesture_handler/src/main/ets/{types.ts → rnoh/types.ts} +0 -0
@@ -1,71 +0,0 @@
1
- import { DescriptorRegistry, Descriptor, Tag } from "@rnoh/react-native-openharmony/ts"
2
- import { Vector2D } from "./Vector2D"
3
-
4
- export type BoundingBox = {
5
- x: number,
6
- y: number,
7
- width: number,
8
- height: number
9
- }
10
-
11
- export class View {
12
- constructor(private descriptorRegistry: DescriptorRegistry, private viewTag: number) {
13
- }
14
-
15
- public getChildren() {
16
- return this.getDescriptor().childrenTags.map(childrenTag => {
17
- return new View(this.descriptorRegistry, childrenTag)
18
- })
19
- }
20
-
21
- public getTag(): Tag {
22
- return this.viewTag
23
- }
24
-
25
- public isPositionInBounds({x, y}: {
26
- x: number,
27
- y: number
28
- }): boolean {
29
- const rect = this.getBoundingRect()
30
- return x >= rect.x && x <= (rect.x + rect.width) && y >= rect.y && y <= (rect.y + rect.height);
31
- }
32
-
33
- public getBoundingRect(): BoundingBox {
34
- const d = this.getDescriptor()
35
- if (!d) {
36
- return { x: 0, y: 0, width: 0, height: 0 }
37
- }
38
- const offsetToAbsolutePosition = this.getOffsetToAbsolutePosition()
39
- return {
40
- x: d.layoutMetrics.frame.origin.x - offsetToAbsolutePosition.x,
41
- y: d.layoutMetrics.frame.origin.y - offsetToAbsolutePosition.y,
42
- width: d.layoutMetrics.frame.size.width,
43
- height: d.layoutMetrics.frame.size.height
44
- }
45
- }
46
-
47
- private getDescriptor() {
48
- return this.descriptorRegistry.getDescriptor(this.viewTag)
49
- }
50
-
51
-
52
- private getOffsetToAbsolutePosition(): Vector2D {
53
- const currentOffset = new Vector2D()
54
- let parentTag = this.getDescriptor()?.parentTag
55
- while (parentTag !== undefined) {
56
- const d = this.descriptorRegistry.getDescriptor(parentTag)
57
- currentOffset.add(this.extractScrollOffsetFromDescriptor(d))
58
- currentOffset.subtract(new Vector2D(d.layoutMetrics.frame.origin))
59
- parentTag = d.parentTag
60
- }
61
- return currentOffset
62
- }
63
-
64
- private extractScrollOffsetFromDescriptor(descriptor: Descriptor<any>) {
65
- if (descriptor.type !== "ScrollView") {
66
- return new Vector2D();
67
- }
68
- const scrollViewState: any = descriptor.state;
69
- return new Vector2D({ x: scrollViewState.contentOffsetX, y: scrollViewState.contentOffsetY })
70
- }
71
- }
@@ -1,43 +0,0 @@
1
- import { DescriptorRegistry, ComponentManagerRegistry, Tag } from "@rnoh/react-native-openharmony/ts"
2
- import { View } from "./View"
3
-
4
- export class ViewRegistry {
5
- constructor(private descriptorRegistry: DescriptorRegistry, private componentManagerRegistry: ComponentManagerRegistry) {
6
- }
7
-
8
- public getViewByTag(viewTag: Tag) {
9
- return this.createView(viewTag)
10
- }
11
-
12
- private createView(tag: Tag): View {
13
- return new View(this.descriptorRegistry, tag)
14
- }
15
-
16
- public getTouchableViewsAt(pos: {
17
- x: number,
18
- y: number
19
- }, rootTag: Tag): View[] {
20
- const rootView = this.createView(rootTag)
21
- const results: View[] = []
22
- for (const view of this.getTouchableViewsAtPosInView(pos, rootView)) {
23
- results.push(view)
24
- }
25
- return results
26
- }
27
-
28
- private getTouchableViewsAtPosInView(pos: {
29
- x: number,
30
- y: number
31
- }, view: View) {
32
- if (!view.isPositionInBounds(pos))
33
- return [];
34
- const results: View[] = []
35
- results.push(view)
36
- for (const child of view.getChildren()) {
37
- for (const result of this.getTouchableViewsAtPosInView(pos, child)) {
38
- results.push(result)
39
- }
40
- }
41
- return results
42
- }
43
- }
@@ -1,17 +0,0 @@
1
- @Entry
2
- @Component
3
- struct Index {
4
- @State message: string = 'Hello World'
5
-
6
- build() {
7
- Row() {
8
- Column() {
9
- Text(this.message)
10
- .fontSize(50)
11
- .fontWeight(FontWeight.Bold)
12
- }
13
- .width('100%')
14
- }
15
- .height('100%')
16
- }
17
- }
@@ -1,41 +0,0 @@
1
- import UIAbility from '@ohos.app.ability.UIAbility';
2
- import hilog from '@ohos.hilog';
3
- import window from '@ohos.window';
4
-
5
- export default class WebviewAbility extends UIAbility {
6
- onCreate(want, launchParam) {
7
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
8
- }
9
-
10
- onDestroy() {
11
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
12
- }
13
-
14
- onWindowStageCreate(windowStage: window.WindowStage) {
15
- // Main window is created, set main page for this ability
16
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
17
-
18
- windowStage.loadContent('pages/Index', (err, data) => {
19
- if (err.code) {
20
- hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
21
- return;
22
- }
23
- hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
24
- });
25
- }
26
-
27
- onWindowStageDestroy() {
28
- // Main window is destroyed, release UI related resources
29
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
30
- }
31
-
32
- onForeground() {
33
- // Ability has brought to foreground
34
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
35
- }
36
-
37
- onBackground() {
38
- // Ability has back to background
39
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
40
- }
41
- }