@react-native-oh-tpl/react-native-gesture-handler 2.12.9 → 2.14.1-2.14.13
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/DrawerLayout/index.ts +2 -0
- package/Swipeable/index.ts +2 -0
- package/harmony/gesture_handler/BuildProfile.ets +15 -3
- package/harmony/gesture_handler/hvigorfile.ts +1 -1
- package/harmony/gesture_handler/index.ets +2 -2
- package/harmony/gesture_handler/oh-package-lock.json5 +4 -3
- package/harmony/gesture_handler/oh-package.json5 +3 -3
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +64 -18
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +3 -3
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +2 -2
- package/harmony/gesture_handler/src/main/cpp/{RNGestureHandlerButtonComponentInstance.h → componentInstances/RNGestureHandlerButtonComponentInstance.h} +2 -2
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +242 -0
- package/harmony/gesture_handler/src/main/ets/{GestureHandler.ts → core/GestureHandler.ts} +54 -27
- package/harmony/gesture_handler/src/main/ets/{GestureHandlerOrchestrator.ts → core/GestureHandlerOrchestrator.ts} +122 -67
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +63 -0
- package/harmony/gesture_handler/src/main/ets/{Event.ts → core/IncomingEvent.ts} +30 -20
- package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +144 -0
- package/harmony/gesture_handler/src/main/ets/{OutgoingEvent.ts → core/OutgoingEvent.ts} +1 -1
- package/harmony/gesture_handler/src/main/ets/core/OutgoingEventDispatcher.ts +12 -0
- package/harmony/gesture_handler/src/main/ets/{PointerTracker.ts → core/PointerTracker.ts} +4 -4
- package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +12 -0
- package/harmony/gesture_handler/src/main/ets/core/Vector2D.ts +80 -0
- package/harmony/gesture_handler/src/main/ets/{VelocityTracker.ts → core/VelocityTracker.ts} +13 -5
- package/harmony/gesture_handler/src/main/ets/core/View.ts +21 -0
- package/harmony/gesture_handler/src/main/ets/core/ViewFinder.ts +11 -0
- package/harmony/gesture_handler/src/main/ets/core/ViewRegistry.ts +8 -0
- package/harmony/gesture_handler/src/main/ets/core/index.ts +15 -0
- package/harmony/gesture_handler/src/main/ets/detectors/ScaleGestureDetector.ts +169 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +211 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +64 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +127 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +42 -0
- package/harmony/gesture_handler/src/main/ets/{NativeViewGestureHandler.ts → gesture-handlers/NativeViewGestureHandler.ts} +15 -15
- package/harmony/gesture_handler/src/main/ets/{PanGestureHandler.ts → gesture-handlers/PanGestureHandler.ts} +27 -13
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +159 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +164 -0
- package/harmony/gesture_handler/src/main/ets/{TapGestureHandler.ts → gesture-handlers/TapGestureHandler.ts} +11 -11
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/detectors/RotationGestureDetector.ts +167 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/index.ts +1 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +8 -9
- package/harmony/gesture_handler/src/main/ets/namespace/{RNGestureHandlerButton.ts → components/RNGestureHandlerButton.ts} +35 -36
- package/harmony/gesture_handler/src/main/ets/namespace/{RNGestureHandlerRootView.ts → components/RNGestureHandlerRootView.ts} +23 -23
- package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +2 -0
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +2 -3
- package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerArkUIAdapter.ts +240 -0
- package/harmony/gesture_handler/src/main/ets/{GestureHandlerPackage.ts → rnoh/GestureHandlerPackage.ts} +4 -4
- package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +49 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +71 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +98 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +110 -0
- package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerButton.ets → rnoh/RNGestureHandlerButton.ets} +3 -3
- package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerModule.ts → rnoh/RNGestureHandlerModule.ts} +79 -29
- package/harmony/gesture_handler/src/main/ets/{RNGestureHandlerRootView.ets → rnoh/RNGestureHandlerRootView.ets} +3 -3
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +24 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +32 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +134 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/ViewRegistry.ts +97 -0
- package/harmony/gesture_handler/src/main/module.json5 +8 -6
- package/harmony/gesture_handler/ts.ts +2 -2
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/index.js +126 -141
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +13 -146
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +39 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +13 -10
- package/src/index.ts +140 -140
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +0 -72
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +0 -78
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +0 -53
- package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ts +0 -203
- package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +0 -45
- package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +0 -28
- package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +0 -109
- package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +0 -48
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerArkTS.ts +0 -60
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +0 -87
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +0 -23
- package/harmony/gesture_handler/src/main/ets/Vector2D.ts +0 -36
- package/harmony/gesture_handler/src/main/ets/View.ts +0 -71
- package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +0 -43
- package/harmony/gesture_handler/src/main/ets/pages/Index.ets +0 -17
- package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +0 -41
- /package/harmony/gesture_handler/src/main/ets/{CircularBuffer.ts → core/CircularBuffer.ts} +0 -0
- /package/harmony/gesture_handler/src/main/ets/{LeastSquareSolver.ts → core/LeastSquareSolver.ts} +0 -0
- /package/harmony/gesture_handler/src/main/ets/{RNGHError.ts → core/RNGHError.ts} +0 -0
- /package/harmony/gesture_handler/src/main/ets/{State.ts → core/State.ts} +0 -0
- /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,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
|
-
}
|
|
File without changes
|
/package/harmony/gesture_handler/src/main/ets/{LeastSquareSolver.ts → core/LeastSquareSolver.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|