@react-native-oh-tpl/react-native-gesture-handler 2.14.13 → 2.14.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/harmony/gesture_handler/BuildProfile.ets +1 -1
- package/harmony/gesture_handler/index.ets +1 -2
- package/harmony/gesture_handler/oh-package-lock.json5 +1 -1
- package/harmony/gesture_handler/oh-package.json5 +1 -1
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +1 -1
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +9 -18
- package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.cpp +123 -0
- package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.h +15 -0
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerButtonComponentInstance.h +17 -17
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +203 -200
- package/harmony/gesture_handler/src/main/ets/RNOHPackage.ets +17 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandler.ts +84 -35
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerOrchestrator.ts +20 -11
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +2 -2
- package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +4 -4
- package/harmony/gesture_handler/src/main/ets/core/Multiset.ts +26 -0
- package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +7 -3
- package/harmony/gesture_handler/src/main/ets/core/ViewRegistry.ts +1 -2
- package/harmony/gesture_handler/src/main/ets/core/index.ts +2 -2
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +12 -4
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +8 -5
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +14 -2
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +9 -1
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/NativeViewGestureHandler.ts +13 -4
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PanGestureHandler.ts +31 -12
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +145 -130
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +9 -1
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/TapGestureHandler.ts +15 -5
- package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerPackage.ts +7 -4
- package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +74 -16
- package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +35 -12
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootViewController.ts +182 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHView.ts +62 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/{GestureHandlerArkUIAdapter.ts → RNGHViewController.ts} +44 -22
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHViewRegistry.ts +19 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerModule.ts +130 -96
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +0 -9
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +1 -8
- package/harmony/gesture_handler.har +0 -0
- package/package.json +7 -3
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +0 -149
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +0 -32
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +0 -22
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +0 -15
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +0 -25
- package/harmony/gesture_handler/src/main/ets/core/ViewFinder.ts +0 -11
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +0 -24
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerButton.ts +0 -139
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerRootView.ts +0 -101
- package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +0 -2
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +0 -2
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +0 -98
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +0 -110
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerButton.ets +0 -38
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerRootView.ets +0 -53
- package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +0 -134
- package/harmony/gesture_handler/src/main/ets/rnoh/ViewRegistry.ts +0 -97
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { DescriptorRegistry, Descriptor, Tag } from '@rnoh/react-native-openharmony/ts';
|
|
2
|
-
import { View, Vector2D, BoundingBox } from "../core"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type RawTouchableView = {
|
|
6
|
-
tag: number,
|
|
7
|
-
/**
|
|
8
|
-
* Relative to application window.
|
|
9
|
-
*/
|
|
10
|
-
x: number,
|
|
11
|
-
/**
|
|
12
|
-
* Relative to application window.
|
|
13
|
-
*/
|
|
14
|
-
y: number,
|
|
15
|
-
width: number,
|
|
16
|
-
height: number,
|
|
17
|
-
buttonRole: boolean,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class ViewCAPI implements View {
|
|
21
|
-
private tag: number
|
|
22
|
-
private buttonRole: boolean
|
|
23
|
-
private boundingBox: BoundingBox
|
|
24
|
-
|
|
25
|
-
constructor({ tag, buttonRole, ...boundingBox }: RawTouchableView) {
|
|
26
|
-
this.tag = tag
|
|
27
|
-
this.buttonRole = buttonRole
|
|
28
|
-
this.boundingBox = boundingBox
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getTag(): number {
|
|
32
|
-
return this.tag
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getBoundingRect(): BoundingBox {
|
|
36
|
-
return { ...this.boundingBox }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
isPositionInBounds({x, y}: {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number
|
|
42
|
-
}): boolean {
|
|
43
|
-
const rect = this.getBoundingRect();
|
|
44
|
-
return (
|
|
45
|
-
x >= rect.x &&
|
|
46
|
-
x <= rect.x + rect.width &&
|
|
47
|
-
y >= rect.y &&
|
|
48
|
-
y <= rect.y + rect.height
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
updateBoundingBox(boundingBox: BoundingBox) {
|
|
53
|
-
this.boundingBox = boundingBox
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setButtonRole(buttonRole: boolean) {
|
|
57
|
-
this.buttonRole = buttonRole
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
hasButtonRole(): boolean {
|
|
61
|
-
return this.buttonRole
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export class ViewArkTS implements View {
|
|
66
|
-
constructor(
|
|
67
|
-
private descriptorRegistry: DescriptorRegistry,
|
|
68
|
-
private viewTag: number,
|
|
69
|
-
) {
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
public getTag(): Tag {
|
|
74
|
-
return this.viewTag;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public isPositionInBounds({x, y}: {
|
|
78
|
-
x: number;
|
|
79
|
-
y: number
|
|
80
|
-
}): boolean {
|
|
81
|
-
const rect = this.getBoundingRect();
|
|
82
|
-
return (
|
|
83
|
-
x >= rect.x &&
|
|
84
|
-
x <= rect.x + rect.width &&
|
|
85
|
-
y >= rect.y &&
|
|
86
|
-
y <= rect.y + rect.height
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public getBoundingRect(): BoundingBox {
|
|
91
|
-
const d = this.getDescriptor();
|
|
92
|
-
if (!d) {
|
|
93
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
94
|
-
}
|
|
95
|
-
const offsetToAbsolutePosition = this.getOffsetToAbsolutePosition();
|
|
96
|
-
return {
|
|
97
|
-
x: d.layoutMetrics.frame.origin.x - offsetToAbsolutePosition.x,
|
|
98
|
-
y: d.layoutMetrics.frame.origin.y - offsetToAbsolutePosition.y,
|
|
99
|
-
width: d.layoutMetrics.frame.size.width,
|
|
100
|
-
height: d.layoutMetrics.frame.size.height,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
private getDescriptor() {
|
|
105
|
-
return this.descriptorRegistry.getDescriptor(this.viewTag);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private getOffsetToAbsolutePosition(): Vector2D {
|
|
109
|
-
const currentOffset = new Vector2D();
|
|
110
|
-
let parentTag = this.getDescriptor()?.parentTag;
|
|
111
|
-
while (parentTag !== undefined) {
|
|
112
|
-
const d = this.descriptorRegistry.getDescriptor(parentTag);
|
|
113
|
-
currentOffset.add(this.extractScrollOffsetFromDescriptor(d));
|
|
114
|
-
currentOffset.subtract(new Vector2D(d.layoutMetrics.frame.origin));
|
|
115
|
-
parentTag = d.parentTag;
|
|
116
|
-
}
|
|
117
|
-
return currentOffset;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
private extractScrollOffsetFromDescriptor(descriptor: Descriptor<any>) {
|
|
121
|
-
if (descriptor.type !== 'ScrollView') {
|
|
122
|
-
return new Vector2D();
|
|
123
|
-
}
|
|
124
|
-
const scrollViewState: any = descriptor.state;
|
|
125
|
-
return new Vector2D({
|
|
126
|
-
x: scrollViewState.contentOffsetX,
|
|
127
|
-
y: scrollViewState.contentOffsetY,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public hasButtonRole(): boolean {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { DescriptorRegistry, Tag, } from '@rnoh/react-native-openharmony/ts';
|
|
2
|
-
import { ViewArkTS } from './View';
|
|
3
|
-
import { View, ViewRegistry } from '../core';
|
|
4
|
-
|
|
5
|
-
export class ViewRegistryArkTS implements ViewRegistry {
|
|
6
|
-
constructor(
|
|
7
|
-
private descriptorRegistry: DescriptorRegistry,
|
|
8
|
-
) {
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
getViewByTag(viewTag: Tag) {
|
|
12
|
-
return this.createView(viewTag);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
save(view: View) {
|
|
16
|
-
/**
|
|
17
|
-
* Currently, a new View object is created when getViewByTag is called. That was the approach in initial "quick"
|
|
18
|
-
* implementation of this library. The save was introduced later, for the needs of implementation using C-API architecture.
|
|
19
|
-
* C-API architecture is going to replace ArkTS anyway, so there's no point of doing this properly since this class
|
|
20
|
-
* will be removed in the future.
|
|
21
|
-
*/
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
deleteByTag(viewTag: Tag) {
|
|
25
|
-
// No-op, ArkTS is going to be deprecated at some point in the future.
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private createView(tag: Tag): ViewArkTS {
|
|
29
|
-
return new ViewArkTS(this.descriptorRegistry, tag);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getTouchableViewsAt(
|
|
33
|
-
pos: {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
},
|
|
37
|
-
rootTag: Tag,
|
|
38
|
-
): ViewArkTS[] {
|
|
39
|
-
const rootView = this.createView(rootTag);
|
|
40
|
-
const results: ViewArkTS[] = [];
|
|
41
|
-
for (const view of this.getTouchableViewsAtPosInView(pos, rootView)) {
|
|
42
|
-
results.push(view);
|
|
43
|
-
}
|
|
44
|
-
return results;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private getTouchableViewsAtPosInView(
|
|
48
|
-
pos: {
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
},
|
|
52
|
-
view: ViewArkTS,
|
|
53
|
-
) {
|
|
54
|
-
if (!view.isPositionInBounds(pos)) return [];
|
|
55
|
-
const results: ViewArkTS[] = [];
|
|
56
|
-
results.push(view);
|
|
57
|
-
for (const child of this.getChildrenOf(view.getTag())) {
|
|
58
|
-
for (const result of this.getTouchableViewsAtPosInView(pos, child)) {
|
|
59
|
-
results.push(result);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return results;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private getChildrenOf(viewTag: Tag): ViewArkTS[] {
|
|
66
|
-
return this.descriptorRegistry.findDescriptorWrapperByTag(viewTag).childrenTags.map((tag) => new ViewArkTS(this.descriptorRegistry, tag))
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export class ViewRegistryCAPI implements ViewRegistry {
|
|
72
|
-
private viewByTag = new Map<Tag, View>()
|
|
73
|
-
|
|
74
|
-
save(view: View) {
|
|
75
|
-
this.viewByTag.set(view.getTag(), view)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
deleteByTag(viewTag: Tag) {
|
|
79
|
-
this.viewByTag.delete(viewTag)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
getViewByTag(viewTag: Tag) {
|
|
83
|
-
return this.viewByTag.get(viewTag);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
getTouchableViewsAt(
|
|
87
|
-
pos: {
|
|
88
|
-
x: number;
|
|
89
|
-
y: number;
|
|
90
|
-
},
|
|
91
|
-
rootTag: Tag,
|
|
92
|
-
): ViewArkTS[] {
|
|
93
|
-
// Finding views is handled on CPP side and provided with the touch event.
|
|
94
|
-
// This method can be removed from ViewRegistry interface once support for ArkTS architecture is removed.
|
|
95
|
-
return []
|
|
96
|
-
}
|
|
97
|
-
}
|