@react-native-oh-tpl/react-native-gesture-handler 2.12.6-1 → 2.12.9-1
Sign up to get free protection for your applications and to get access to all the features.
- package/harmony/gesture_handler/BuildProfile.ets +6 -0
- package/harmony/gesture_handler/build-profile.json5 +18 -7
- package/harmony/gesture_handler/hvigorfile.ts +2 -2
- package/harmony/gesture_handler/index.ets +3 -3
- package/harmony/gesture_handler/oh-package-lock.json5 +18 -0
- package/harmony/gesture_handler/oh-package.json5 +12 -11
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +103 -34
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +21 -15
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +36 -60
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentInstance.h +27 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +32 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +22 -17
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +15 -12
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +72 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +36 -60
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +123 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +25 -0
- package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +42 -42
- package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +52 -37
- package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
- package/harmony/gesture_handler/src/main/ets/{GestureHandlerArkUIAdapter.ets → GestureHandlerArkUIAdapter.ts} +202 -201
- package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +44 -44
- package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +280 -280
- package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +22 -22
- package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +27 -27
- package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +108 -108
- package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +182 -182
- package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +114 -114
- package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +33 -33
- package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +327 -327
- package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +239 -239
- package/harmony/gesture_handler/src/main/ets/RNGHError.ts +4 -4
- package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +47 -28
- package/harmony/gesture_handler/src/main/ets/{RNGHRootTouchHandler.ets → RNGHRootTouchHandlerArkTS.ts} +59 -57
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +87 -0
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +37 -36
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +183 -125
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +52 -55
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +23 -11
- package/harmony/gesture_handler/src/main/ets/State.ts +46 -46
- package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +205 -205
- package/harmony/gesture_handler/src/main/ets/Vector2D.ts +36 -36
- package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +98 -98
- package/harmony/gesture_handler/src/main/ets/View.ts +70 -70
- package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +42 -42
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerButton.ts +140 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +25 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerRootView.ts +101 -0
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +3 -0
- package/harmony/gesture_handler/src/main/ets/pages/Index.ets +16 -16
- package/harmony/gesture_handler/src/main/ets/types.ts +25 -0
- package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
- package/harmony/gesture_handler/src/main/module.json5 +7 -7
- package/harmony/gesture_handler/src/main/resources/base/element/color.json +7 -7
- package/harmony/gesture_handler/src/main/resources/base/element/string.json +15 -15
- package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/gesture_handler/ts.ts +2 -1
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/RNGestureHandlerModule.js +6 -3
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +5 -13
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +31 -28
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/index.js +42 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +10 -0
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +3 -2
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +3 -11
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/handlers/createHandler.js +20 -19
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/index.js +6 -14
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -6
- package/lib/typescript/RNGestureHandlerModule.d.ts.map +1 -1
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
- package/lib/typescript/components/GestureHandlerRootView.d.ts.map +1 -1
- package/lib/typescript/handlers/createHandler.d.ts +11 -11
- package/lib/typescript/handlers/createHandler.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +9 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +15 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +15 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +7 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -0
- package/package.json +66 -70
- package/src/RNGestureHandlerModule.ts +5 -6
- package/src/components/GestureHandlerRootView.tsx +23 -34
- package/src/handlers/createHandler.tsx +534 -535
- package/src/index.ts +172 -172
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -0
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
- package/README.md +0 -1
- package/lib/commonjs/components/GestureButtons.js +0 -186
- package/lib/commonjs/components/GestureButtons.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.js +0 -9
- package/lib/commonjs/components/GestureHandlerButton.js.map +0 -1
- package/lib/commonjs/components/RNGestureHandlerButton.js +0 -23
- package/lib/commonjs/components/RNGestureHandlerButton.js.map +0 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +0 -247
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +0 -58
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +0 -18
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/commonjs/components/touchables/index.js +0 -21
- package/lib/commonjs/components/touchables/index.js.map +0 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -19
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +0 -103
- package/lib/commonjs/handlers/PanGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +0 -22
- package/lib/commonjs/handlers/TapGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +0 -64
- package/lib/commonjs/handlers/createNativeWrapper.js.map +0 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -22
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -554
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/commonjs/init.js +0 -24
- package/lib/commonjs/init.js.map +0 -1
- package/lib/module/components/GestureButtons.js +0 -168
- package/lib/module/components/GestureButtons.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.js +0 -3
- package/lib/module/components/GestureHandlerButton.js.map +0 -1
- package/lib/module/components/RNGestureHandlerButton.js +0 -17
- package/lib/module/components/RNGestureHandlerButton.js.map +0 -1
- package/lib/module/components/touchables/GenericTouchable.js +0 -238
- package/lib/module/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/module/components/touchables/TouchableOpacity.js +0 -49
- package/lib/module/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +0 -9
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/module/components/touchables/index.js +0 -8
- package/lib/module/components/touchables/index.js.map +0 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +0 -12
- package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/handlers/PanGestureHandler.js +0 -92
- package/lib/module/handlers/PanGestureHandler.js.map +0 -1
- package/lib/module/handlers/TapGestureHandler.js +0 -14
- package/lib/module/handlers/TapGestureHandler.js.map +0 -1
- package/lib/module/handlers/createNativeWrapper.js +0 -57
- package/lib/module/handlers/createNativeWrapper.js.map +0 -1
- package/lib/module/handlers/gestureHandlerCommon.js +0 -15
- package/lib/module/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector.js +0 -543
- package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/module/init.js +0 -17
- package/lib/module/init.js.map +0 -1
- package/lib/typescript/components/GestureButtons.d.ts +0 -122
- package/lib/typescript/components/GestureButtons.d.ts.map +0 -1
- package/lib/typescript/components/GestureHandlerButton.d.ts +0 -5
- package/lib/typescript/components/GestureHandlerButton.d.ts.map +0 -1
- package/lib/typescript/components/RNGestureHandlerButton.d.ts +0 -2
- package/lib/typescript/components/RNGestureHandlerButton.d.ts.map +0 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -68
- package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +0 -1
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -26
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts.map +0 -1
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -8
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts.map +0 -1
- package/lib/typescript/components/touchables/index.d.ts +0 -4
- package/lib/typescript/components/touchables/index.d.ts.map +0 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -29
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -140
- package/lib/typescript/handlers/PanGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -58
- package/lib/typescript/handlers/TapGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -4
- package/lib/typescript/handlers/createNativeWrapper.d.ts.map +0 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -2
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +0 -24
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts.map +0 -1
- package/lib/typescript/init.d.ts +0 -3
- package/lib/typescript/init.d.ts.map +0 -1
- package/src/components/GestureButtons.tsx +0 -334
- package/src/components/GestureHandlerButton.tsx +0 -5
- package/src/components/RNGestureHandlerButton.tsx +0 -23
- package/src/components/touchables/GenericTouchable.tsx +0 -301
- package/src/components/touchables/TouchableOpacity.tsx +0 -76
- package/src/components/touchables/TouchableWithoutFeedback.tsx +0 -14
- package/src/components/touchables/index.ts +0 -7
- package/src/handlers/NativeViewGestureHandler.ts +0 -55
- package/src/handlers/PanGestureHandler.ts +0 -327
- package/src/handlers/TapGestureHandler.ts +0 -95
- package/src/handlers/createNativeWrapper.tsx +0 -81
- package/src/handlers/gestureHandlerCommon.ts +0 -15
- package/src/handlers/gestures/GestureDetector.tsx +0 -823
- package/src/init.ts +0 -18
@@ -1,60 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#include
|
7
|
-
#include
|
8
|
-
|
9
|
-
|
10
|
-
namespace
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
};
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
};
|
38
|
-
|
39
|
-
class RNGestureHandlerRootViewProps : public ViewProps {
|
40
|
-
public:
|
41
|
-
RNGestureHandlerRootViewProps() = default;
|
42
|
-
|
43
|
-
RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
|
44
|
-
: ViewProps(context, sourceProps, rawProps) {}
|
45
|
-
};
|
46
|
-
|
47
|
-
using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
|
48
|
-
RNGestureHandlerRootViewComponentName,
|
49
|
-
RNGestureHandlerRootViewProps,
|
50
|
-
RNGestureHandlerRootViewEventEmitter>;
|
51
|
-
|
52
|
-
class RNGestureHandlerRootViewComponentDescriptor final
|
53
|
-
: public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
|
54
|
-
public:
|
55
|
-
RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
56
|
-
: ConcreteComponentDescriptor(parameters) {}
|
57
|
-
};
|
58
|
-
|
59
|
-
} // namespace react
|
60
|
-
} // namespace facebook
|
1
|
+
|
2
|
+
#pragma once
|
3
|
+
|
4
|
+
// This file was generated.
|
5
|
+
|
6
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
8
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
9
|
+
|
10
|
+
namespace facebook {
|
11
|
+
namespace react {
|
12
|
+
|
13
|
+
extern const char RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
|
14
|
+
|
15
|
+
class RNGestureHandlerRootViewProps : public ViewProps {
|
16
|
+
public:
|
17
|
+
RNGestureHandlerRootViewProps() = default;
|
18
|
+
|
19
|
+
RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
|
20
|
+
: ViewProps(context, sourceProps, rawProps) {}
|
21
|
+
};
|
22
|
+
|
23
|
+
using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
|
24
|
+
RNGestureHandlerRootViewComponentName,
|
25
|
+
RNGestureHandlerRootViewProps,
|
26
|
+
ViewEventEmitter>;
|
27
|
+
|
28
|
+
class RNGestureHandlerRootViewComponentDescriptor final
|
29
|
+
: public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
|
30
|
+
public:
|
31
|
+
RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
32
|
+
: ConcreteComponentDescriptor(parameters) {}
|
33
|
+
};
|
34
|
+
|
35
|
+
} // namespace react
|
36
|
+
} // namespace facebook
|
@@ -0,0 +1,123 @@
|
|
1
|
+
#pragma once
|
2
|
+
#import "RNOH/CppComponentInstance.h"
|
3
|
+
#import "RNOH/arkui/StackNode.h"
|
4
|
+
#import "RNOH/arkui/ArkUINodeRegistry.h"
|
5
|
+
#import "RNOH/arkui/NativeNodeApi.h"
|
6
|
+
#import "RNGestureHandlerRootViewComponentDescriptor.h"
|
7
|
+
#include "RNOH/arkui/TouchEventDispatcher.h"
|
8
|
+
|
9
|
+
namespace rnoh {
|
10
|
+
class RNGestureHandlerRootViewComponentInstance
|
11
|
+
: public CppComponentInstance<facebook::react::RNGestureHandlerRootViewShadowNode>,
|
12
|
+
public TouchEventHandler {
|
13
|
+
private:
|
14
|
+
StackNode m_stackNode;
|
15
|
+
|
16
|
+
public:
|
17
|
+
RNGestureHandlerRootViewComponentInstance(Context context) : CppComponentInstance(std::move(context)) {
|
18
|
+
ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
|
19
|
+
NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT, 0, nullptr);
|
20
|
+
m_deps->arkTSChannel->postMessage("RNGH::ROOT_CREATED", m_tag);
|
21
|
+
};
|
22
|
+
|
23
|
+
~RNGestureHandlerRootViewComponentInstance() {
|
24
|
+
ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
|
25
|
+
NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
|
26
|
+
}
|
27
|
+
|
28
|
+
StackNode &getLocalRootArkUINode() override { return m_stackNode; };
|
29
|
+
|
30
|
+
void onTouchEvent(ArkUI_UIInputEvent *e) override {
|
31
|
+
folly::dynamic payload = folly::dynamic::object;
|
32
|
+
payload["action"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetAction(e));
|
33
|
+
payload["actionTouch"] = this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e));
|
34
|
+
folly::dynamic touchPoints = folly::dynamic::array();
|
35
|
+
touchPoints.push_back(this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e)));
|
36
|
+
payload["touchPoints"] = touchPoints;
|
37
|
+
payload["sourceType"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetSourceType(e));
|
38
|
+
payload["timestamp"] = OH_ArkUI_UIInputEvent_GetEventTime(e);
|
39
|
+
payload["rootTag"] = m_tag;
|
40
|
+
m_deps->arkTSChannel->postMessage("RNGH::TOUCH_EVENT", payload);
|
41
|
+
}
|
42
|
+
|
43
|
+
private:
|
44
|
+
struct TouchPoint {
|
45
|
+
int32_t contactAreaHeight;
|
46
|
+
int32_t contactAreaWidth;
|
47
|
+
int32_t id;
|
48
|
+
int32_t nodeX;
|
49
|
+
int32_t nodeY;
|
50
|
+
int64_t pressedTime;
|
51
|
+
double pressure;
|
52
|
+
int32_t rawX;
|
53
|
+
int32_t rawY;
|
54
|
+
int32_t screenX;
|
55
|
+
int32_t screenY;
|
56
|
+
double tiltX;
|
57
|
+
double tiltY;
|
58
|
+
int32_t toolHeight;
|
59
|
+
int32_t toolWidth;
|
60
|
+
int32_t toolX;
|
61
|
+
int32_t toolY;
|
62
|
+
int32_t toolType;
|
63
|
+
int32_t windowX;
|
64
|
+
int32_t windowY;
|
65
|
+
};
|
66
|
+
|
67
|
+
TouchPoint getActiveTouchFromEvent(ArkUI_UIInputEvent *event) {
|
68
|
+
TouchPoint actionTouch{};
|
69
|
+
actionTouch = TouchPoint{
|
70
|
+
.contactAreaHeight = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaHeight(event, 0)),
|
71
|
+
.contactAreaWidth = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaWidth(event, 0)),
|
72
|
+
.id = OH_ArkUI_PointerEvent_GetPointerId(event, 0),
|
73
|
+
.nodeX = int32_t(OH_ArkUI_PointerEvent_GetX(event)),
|
74
|
+
.nodeY = int32_t(OH_ArkUI_PointerEvent_GetY(event)),
|
75
|
+
.pressure = double(OH_ArkUI_PointerEvent_GetPressure(event, 0)),
|
76
|
+
.screenX = int32_t(OH_ArkUI_PointerEvent_GetDisplayX(event)),
|
77
|
+
.screenY = int32_t(OH_ArkUI_PointerEvent_GetDisplayY(event)),
|
78
|
+
.tiltX = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
|
79
|
+
.tiltY = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
|
80
|
+
.toolType = int32_t(OH_ArkUI_UIInputEvent_GetToolType(event)),
|
81
|
+
.windowX = int32_t(OH_ArkUI_PointerEvent_GetWindowX(event)),
|
82
|
+
.windowY = int32_t(OH_ArkUI_PointerEvent_GetWindowY(event)),
|
83
|
+
};
|
84
|
+
return actionTouch;
|
85
|
+
}
|
86
|
+
|
87
|
+
folly::dynamic convertNodeTouchPointToDynamic(TouchPoint actionTouch) {
|
88
|
+
folly::dynamic result = folly::dynamic::object;
|
89
|
+
result["contactAreaHeight"] = actionTouch.contactAreaHeight;
|
90
|
+
result["contactAreaWidth"] = actionTouch.contactAreaWidth;
|
91
|
+
result["id"] = actionTouch.id;
|
92
|
+
result["nodeX"] = actionTouch.nodeX;
|
93
|
+
result["nodeY"] = actionTouch.nodeY;
|
94
|
+
// result["pressedTime"] = actionTouch.pressedTime;
|
95
|
+
result["pressure"] = actionTouch.pressure;
|
96
|
+
// result["rawX"] = actionTouch.rawX;
|
97
|
+
// result["rawY"] = actionTouch.rawY;
|
98
|
+
result["screenX"] = actionTouch.screenX;
|
99
|
+
result["screenY"] = actionTouch.screenY;
|
100
|
+
result["tiltX"] = actionTouch.tiltX;
|
101
|
+
result["tiltY"] = actionTouch.tiltY;
|
102
|
+
// result["toolHeight"] = actionTouch.toolHeight;
|
103
|
+
// result["toolWidth"] = actionTouch.toolWidth;
|
104
|
+
// result["toolX"] = actionTouch.toolX;
|
105
|
+
// result["toolY"] = actionTouch.toolY;
|
106
|
+
result["toolType"] = static_cast<int>(actionTouch.toolType);
|
107
|
+
result["windowX"] = actionTouch.windowX;
|
108
|
+
result["windowY"] = actionTouch.windowY;
|
109
|
+
return result;
|
110
|
+
}
|
111
|
+
|
112
|
+
protected:
|
113
|
+
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
|
114
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
115
|
+
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
116
|
+
};
|
117
|
+
|
118
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
|
119
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
120
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
121
|
+
};
|
122
|
+
};
|
123
|
+
} // namespace rnoh
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
// This file was generated.
|
4
|
+
|
5
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
6
|
+
|
7
|
+
namespace rnoh {
|
8
|
+
class RNGestureHandlerRootViewJSIBinder : public ViewComponentJSIBinder {
|
9
|
+
protected:
|
10
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
11
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
12
|
+
return object;
|
13
|
+
}
|
14
|
+
|
15
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
16
|
+
facebook::jsi::Object events(rt);
|
17
|
+
return events;
|
18
|
+
}
|
19
|
+
|
20
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
21
|
+
facebook::jsi::Object events(rt);
|
22
|
+
return events;
|
23
|
+
}
|
24
|
+
};
|
25
|
+
} // namespace rnoh
|
@@ -1,42 +1,42 @@
|
|
1
|
-
export class CircularBuffer<T> {
|
2
|
-
private bufferSize: number;
|
3
|
-
private buffer: T[];
|
4
|
-
private index: number;
|
5
|
-
private actualSize: number;
|
6
|
-
|
7
|
-
constructor(size: number) {
|
8
|
-
this.bufferSize = size;
|
9
|
-
this.buffer = new Array<T>(size);
|
10
|
-
this.index = 0;
|
11
|
-
this.actualSize = 0;
|
12
|
-
}
|
13
|
-
|
14
|
-
public get size(): number {
|
15
|
-
return this.actualSize;
|
16
|
-
}
|
17
|
-
|
18
|
-
public push(element: T): void {
|
19
|
-
this.buffer[this.index] = element;
|
20
|
-
this.index = (this.index + 1) % this.bufferSize;
|
21
|
-
this.actualSize = Math.min(this.actualSize + 1, this.bufferSize);
|
22
|
-
}
|
23
|
-
|
24
|
-
public get(at: number): T {
|
25
|
-
if (this.actualSize === this.bufferSize) {
|
26
|
-
let index = (this.index + at) % this.bufferSize;
|
27
|
-
if (index < 0) {
|
28
|
-
index += this.bufferSize;
|
29
|
-
}
|
30
|
-
|
31
|
-
return this.buffer[index];
|
32
|
-
} else {
|
33
|
-
return this.buffer[at];
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
public clear(): void {
|
38
|
-
this.buffer = new Array<T>(this.bufferSize);
|
39
|
-
this.index = 0;
|
40
|
-
this.actualSize = 0;
|
41
|
-
}
|
42
|
-
}
|
1
|
+
export class CircularBuffer<T> {
|
2
|
+
private bufferSize: number;
|
3
|
+
private buffer: T[];
|
4
|
+
private index: number;
|
5
|
+
private actualSize: number;
|
6
|
+
|
7
|
+
constructor(size: number) {
|
8
|
+
this.bufferSize = size;
|
9
|
+
this.buffer = new Array<T>(size);
|
10
|
+
this.index = 0;
|
11
|
+
this.actualSize = 0;
|
12
|
+
}
|
13
|
+
|
14
|
+
public get size(): number {
|
15
|
+
return this.actualSize;
|
16
|
+
}
|
17
|
+
|
18
|
+
public push(element: T): void {
|
19
|
+
this.buffer[this.index] = element;
|
20
|
+
this.index = (this.index + 1) % this.bufferSize;
|
21
|
+
this.actualSize = Math.min(this.actualSize + 1, this.bufferSize);
|
22
|
+
}
|
23
|
+
|
24
|
+
public get(at: number): T {
|
25
|
+
if (this.actualSize === this.bufferSize) {
|
26
|
+
let index = (this.index + at) % this.bufferSize;
|
27
|
+
if (index < 0) {
|
28
|
+
index += this.bufferSize;
|
29
|
+
}
|
30
|
+
|
31
|
+
return this.buffer[index];
|
32
|
+
} else {
|
33
|
+
return this.buffer[at];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
public clear(): void {
|
38
|
+
this.buffer = new Array<T>(this.bufferSize);
|
39
|
+
this.index = 0;
|
40
|
+
this.actualSize = 0;
|
41
|
+
}
|
42
|
+
}
|
@@ -1,68 +1,68 @@
|
|
1
|
-
export interface HitSlop {
|
2
|
-
left?: number;
|
3
|
-
right?: number;
|
4
|
-
top?: number;
|
5
|
-
bottom?: number;
|
6
|
-
horizontal?: number;
|
7
|
-
vertical?: number;
|
8
|
-
width?: number;
|
9
|
-
height?: number;
|
10
|
-
}
|
11
|
-
|
12
|
-
export const Directions = {
|
13
|
-
RIGHT: 1,
|
14
|
-
LEFT: 2,
|
15
|
-
UP: 4,
|
16
|
-
DOWN: 8,
|
17
|
-
} as const;
|
18
|
-
|
19
|
-
export enum PointerType {
|
20
|
-
NONE = 'none',
|
21
|
-
MOUSE = 'mouse',
|
22
|
-
TOUCH = 'touch',
|
23
|
-
PEN = 'pen',
|
24
|
-
}
|
25
|
-
|
26
|
-
export enum EventType {
|
27
|
-
DOWN,
|
28
|
-
ADDITIONAL_POINTER_DOWN,
|
29
|
-
UP,
|
30
|
-
ADDITIONAL_POINTER_UP,
|
31
|
-
MOVE,
|
32
|
-
ENTER,
|
33
|
-
OUT,
|
34
|
-
CANCEL,
|
35
|
-
}
|
36
|
-
|
37
|
-
export type Touch = {id: number, x: number, y: number, absoluteX: number, absoluteY: number}
|
38
|
-
|
39
|
-
export enum TouchEventType {
|
40
|
-
UNDETERMINED = 0,
|
41
|
-
DOWN = 1,
|
42
|
-
MOVE = 2,
|
43
|
-
UP = 3,
|
44
|
-
CANCELLED = 4,
|
45
|
-
}
|
46
|
-
|
47
|
-
export interface AdaptedEvent {
|
48
|
-
x: number;
|
49
|
-
y: number;
|
50
|
-
offsetX: number;
|
51
|
-
offsetY: number;
|
52
|
-
pointerId: number;
|
53
|
-
eventType: EventType;
|
54
|
-
pointerType: PointerType;
|
55
|
-
buttons: number;
|
56
|
-
time: number;
|
57
|
-
allTouches?: Touch[];
|
58
|
-
changedTouches?: Touch[];
|
59
|
-
touchEventType?: TouchEventType;
|
60
|
-
}
|
61
|
-
|
62
|
-
export interface TrackerElement {
|
63
|
-
lastX: number;
|
64
|
-
lastY: number;
|
65
|
-
timeStamp: number;
|
66
|
-
velocityX: number;
|
67
|
-
velocityY: number;
|
1
|
+
export interface HitSlop {
|
2
|
+
left?: number;
|
3
|
+
right?: number;
|
4
|
+
top?: number;
|
5
|
+
bottom?: number;
|
6
|
+
horizontal?: number;
|
7
|
+
vertical?: number;
|
8
|
+
width?: number;
|
9
|
+
height?: number;
|
10
|
+
}
|
11
|
+
|
12
|
+
export const Directions = {
|
13
|
+
RIGHT: 1,
|
14
|
+
LEFT: 2,
|
15
|
+
UP: 4,
|
16
|
+
DOWN: 8,
|
17
|
+
} as const;
|
18
|
+
|
19
|
+
export enum PointerType {
|
20
|
+
NONE = 'none',
|
21
|
+
MOUSE = 'mouse',
|
22
|
+
TOUCH = 'touch',
|
23
|
+
PEN = 'pen',
|
24
|
+
}
|
25
|
+
|
26
|
+
export enum EventType {
|
27
|
+
DOWN,
|
28
|
+
ADDITIONAL_POINTER_DOWN,
|
29
|
+
UP,
|
30
|
+
ADDITIONAL_POINTER_UP,
|
31
|
+
MOVE,
|
32
|
+
ENTER,
|
33
|
+
OUT,
|
34
|
+
CANCEL,
|
35
|
+
}
|
36
|
+
|
37
|
+
export type Touch = {id: number, x: number, y: number, absoluteX: number, absoluteY: number}
|
38
|
+
|
39
|
+
export enum TouchEventType {
|
40
|
+
UNDETERMINED = 0,
|
41
|
+
DOWN = 1,
|
42
|
+
MOVE = 2,
|
43
|
+
UP = 3,
|
44
|
+
CANCELLED = 4,
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface AdaptedEvent {
|
48
|
+
x: number;
|
49
|
+
y: number;
|
50
|
+
offsetX: number;
|
51
|
+
offsetY: number;
|
52
|
+
pointerId: number;
|
53
|
+
eventType: EventType;
|
54
|
+
pointerType: PointerType;
|
55
|
+
buttons: number;
|
56
|
+
time: number;
|
57
|
+
allTouches?: Touch[];
|
58
|
+
changedTouches?: Touch[];
|
59
|
+
touchEventType?: TouchEventType;
|
60
|
+
}
|
61
|
+
|
62
|
+
export interface TrackerElement {
|
63
|
+
lastX: number;
|
64
|
+
lastY: number;
|
65
|
+
timeStamp: number;
|
66
|
+
velocityX: number;
|
67
|
+
velocityY: number;
|
68
68
|
}
|
@@ -1,38 +1,53 @@
|
|
1
|
-
import { RNInstance } from "rnoh/ts"
|
2
|
-
import { GestureStateChangeEvent, GestureUpdateEvent, GestureTouchEvent } from "./OutgoingEvent"
|
3
|
-
import { RNGHLogger } from './RNGHLogger'
|
4
|
-
|
5
|
-
export interface EventDispatcher {
|
6
|
-
onGestureHandlerStateChange(event: GestureStateChangeEvent): void
|
7
|
-
onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent): void
|
8
|
-
}
|
9
|
-
|
10
|
-
export class JSEventDispatcher implements EventDispatcher {
|
11
|
-
constructor(private rnInstance: RNInstance, private logger: RNGHLogger) {
|
12
|
-
}
|
13
|
-
|
14
|
-
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
15
|
-
this.logger.info(`onGestureHandlerStateChange`)
|
16
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
17
|
-
}
|
18
|
-
|
19
|
-
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
20
|
-
this.logger.info(`onGestureHandlerEvent`)
|
21
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerEvent", event)
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
export class AnimatedEventDispatcher implements EventDispatcher {
|
26
|
-
constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
|
27
|
-
}
|
28
|
-
|
29
|
-
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
30
|
-
this.logger.info(`onGestureHandlerStateChange`)
|
31
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
32
|
-
}
|
33
|
-
|
34
|
-
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
35
|
-
this.logger.info(`onGestureHandlerEvent`)
|
36
|
-
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
|
37
|
-
}
|
1
|
+
import { RNInstance } from "@rnoh/react-native-openharmony/ts"
|
2
|
+
import { GestureStateChangeEvent, GestureUpdateEvent, GestureTouchEvent } from "./OutgoingEvent"
|
3
|
+
import { RNGHLogger } from './RNGHLogger'
|
4
|
+
|
5
|
+
export interface EventDispatcher {
|
6
|
+
onGestureHandlerStateChange(event: GestureStateChangeEvent): void
|
7
|
+
onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent): void
|
8
|
+
}
|
9
|
+
|
10
|
+
export class JSEventDispatcher implements EventDispatcher {
|
11
|
+
constructor(private rnInstance: RNInstance, private logger: RNGHLogger) {
|
12
|
+
}
|
13
|
+
|
14
|
+
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
15
|
+
this.logger.info(`onGestureHandlerStateChange`)
|
16
|
+
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
17
|
+
}
|
18
|
+
|
19
|
+
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
20
|
+
this.logger.info(`onGestureHandlerEvent`)
|
21
|
+
this.rnInstance.emitDeviceEvent("onGestureHandlerEvent", event)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
export class AnimatedEventDispatcher implements EventDispatcher {
|
26
|
+
constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
|
27
|
+
}
|
28
|
+
|
29
|
+
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
30
|
+
this.logger.info(`onGestureHandlerStateChange`)
|
31
|
+
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
32
|
+
}
|
33
|
+
|
34
|
+
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
35
|
+
this.logger.info(`onGestureHandlerEvent`)
|
36
|
+
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
export class ReanimatedEventDispatcher implements EventDispatcher {
|
41
|
+
constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
|
42
|
+
}
|
43
|
+
|
44
|
+
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
45
|
+
this.logger.info(`onGestureHandlerStateChange`)
|
46
|
+
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerStateChange", event)
|
47
|
+
}
|
48
|
+
|
49
|
+
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
50
|
+
this.logger.info(`onGestureHandlerEvent`)
|
51
|
+
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
|
52
|
+
}
|
38
53
|
}
|