@react-native-ohos/react-native-clippathview 1.1.9-rc.2 → 1.2.0

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.
@@ -55,17 +55,17 @@ private:
55
55
  static void close(OH_Drawing_Path *cPath_);
56
56
  static void arcToBezier(float cx, float cy, float rx, float ry, float sa, float ea, bool clockwise, float rad,
57
57
  OH_Drawing_Path *cPath_);
58
- static void SetPenDown();
58
+ static void setPenDown();
59
59
  static double _round(double val);
60
- static void SkipSpaces();
61
- static bool IsCmd(char c);
60
+ static void skip_spaces();
61
+ static bool is_cmd(char c);
62
62
  static bool is_number_start(char c);
63
63
  static bool is_absolute(char c);
64
64
  static bool parse_flag();
65
65
  static float parse_list_number();
66
66
  static float parse_number();
67
67
  static void parse_list_separator();
68
- static void SkipDigits();
68
+ static void skip_digits();
69
69
  };
70
70
  } // namespace rnoh
71
71
  #endif // HARMONY_SVGPATHPARSER_H
@@ -4,7 +4,7 @@
4
4
  * you may not use this file except in compliance with the License.
5
5
  * You may obtain a copy of the License at
6
6
  *
7
- * http://www.apache.org/licenses/LICENSE-2.0
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
8
  *
9
9
  * Unless required by applicable law or agreed to in writing, software
10
10
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  #include "SVGViewBox.h"
17
- #include <cmath>
17
+ #include <math.h>
18
18
  #include <native_drawing/drawing_matrix.h>
19
19
  #include <native_drawing/drawing_rect.h>
20
20
  #include <native_drawing/drawing_types.h>
@@ -23,8 +23,8 @@
23
23
  #include <glog/logging.h>
24
24
 
25
25
  void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect, std::string align, int meetOrSlice,
26
- float density, OH_Drawing_Matrix *result)
27
- {
26
+ float density, OH_Drawing_Matrix *result) {
27
+
28
28
  double vbX = OH_Drawing_RectGetLeft(vbRect) * density;
29
29
  double vbY = OH_Drawing_RectGetTop(vbRect) * density;
30
30
  double vbX2 = OH_Drawing_RectGetRight(vbRect) * density;
@@ -49,7 +49,6 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
49
49
  // Initialize translate-y to e-y - (vb-y * scale-y).
50
50
  double translateX = eX - (vbX * scaleX);
51
51
  double translateY = eY - (vbY * scaleY);
52
- double point2 = 2.0;
53
52
 
54
53
  // If align is 'none'
55
54
  if (meetOrSlice == MOS_NONE) {
@@ -57,8 +56,9 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
57
56
  // Assign scale-x and scale-y to scale.
58
57
  double scale = scaleX = scaleY = fmin(scaleX, scaleY);
59
58
 
60
- translateX += (eWidth - vbWidth * scaleX) / point2;
61
- translateY += (eHeight - vbHeight * scaleY) / point2;
59
+ translateX += (eWidth - vbWidth * scaleX) / 2.0;
60
+ translateY += (eHeight - vbHeight * scaleY) / 2.0;
61
+
62
62
  } else {
63
63
  // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller.
64
64
  // Otherwise, if align is not 'none' and meetOrSlice is 'slice', set the smaller of scale-x and scale-y to the
@@ -71,7 +71,7 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
71
71
 
72
72
  // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x.
73
73
  if (align.find("xMid") != std::string::npos) {
74
- translateX += (eWidth - vbWidth * scaleX) / point2;
74
+ translateX += (eWidth - vbWidth * scaleX) / 2.0;
75
75
  }
76
76
  // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
77
77
  if (align.find("xMax") != std::string::npos) {
@@ -80,7 +80,7 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
80
80
 
81
81
  // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y.
82
82
  if (align.find("YMid") != std::string::npos) {
83
- translateY += (eHeight - vbHeight * scaleY) / point2;
83
+ translateY += (eHeight - vbHeight * scaleY) / 2.0;
84
84
  }
85
85
 
86
86
  // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
@@ -13,12 +13,10 @@
13
13
  * limitations under the License.
14
14
  */
15
15
 
16
- #include "ShadowNodes.h"
17
-
18
16
  namespace facebook {
19
17
  namespace react {
20
18
 
21
- const char RNCClipPathViewComponentName[] = "RNCClipPathView";
22
- const char RNCClipPathViewNoneComponentName[] = "RNCClipPathViewNone";
19
+ extern const char RNCClipPathViewComponentName[] = "RNCClipPathView";
20
+ extern const char RNCClipPathViewNoneComponentName[] = "RNCClipPathViewNone";
23
21
  } // namespace react
24
22
  } // namespace facebook
@@ -1,26 +1,10 @@
1
- /*
2
- * Copyright (C) 2022 Huawei Device Co., Ltd.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
1
+ //
2
+ // Created on 2024/7/4.
3
+ //
15
4
  // Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
16
5
  // please include "napi/native_api.h".
17
6
 
18
- #ifndef PEN_STYLE_NODE_H
19
- #define PEN_STYLE_NODE_H
20
-
21
7
  typedef enum {
22
8
  CLIP_PEN_STYLE_FILL = 1 << 0,
23
9
  CLIP_PEN_STYLE_STROKE = 1 << 1,
24
- } Clip_PenStyleType;
25
-
26
- #endif
10
+ } Clip_PenStyleType;
@@ -25,7 +25,6 @@
25
25
  import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
26
26
  import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
27
27
  import { ClipPathTurboModule } from './ClipPathTurboModule';
28
- import { RNOHPackage } from "@rnoh/react-native-openharmony";
29
28
 
30
29
  class ClipPathTurboModulesFactory extends TurboModulesFactory {
31
30
  createTurboModule(name: string): TurboModule | null {
@@ -40,7 +39,7 @@ class ClipPathTurboModulesFactory extends TurboModulesFactory {
40
39
  }
41
40
  }
42
41
 
43
- export class ClipPathPackage extends RNOHPackage {
42
+ export class ClipPathPackage extends RNPackage {
44
43
  createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
45
44
  return new ClipPathTurboModulesFactory(ctx);
46
45
  }
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-clippathview",
3
3
  "title": "React Native ClipPath",
4
- "version": "1.1.9-rc.2",
4
+ "version": "1.2.0",
5
5
  "description": "ClipPath Android Web IOS Harmony",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-clippath.git",
21
+ "url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-clippath.git",
22
22
  "baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-clippath"
23
23
  },
24
24
  "keywords": [
@@ -35,9 +35,9 @@
35
35
  "GPU",
36
36
  "Hardware accelerated"
37
37
  ],
38
- "author": {
39
- "name": "Juan J LF",
40
- "email": "justinjlf21@gmail.com"
38
+ "publishConfig": {
39
+ "registry": "https://registry.npmjs.org/",
40
+ "access": "public"
41
41
  },
42
42
  "license": "MIT",
43
43
  "licenseFilename": "LICENSE",
@@ -55,12 +55,6 @@
55
55
  "svgpath": "^2.3.1"
56
56
  },
57
57
  "harmony": {
58
- "alias": "react-native-clippathview",
59
- "autolinking": {
60
- "etsPackageClassName":"ClipPathPackage",
61
- "cppPackageClassName":"ClipPathViewPackage",
62
- "cmakeLibraryTargetName": "rnoh_clip_path",
63
- "ohPackageName": "@react-native-ohos/react-native-clippathview"
64
- }
58
+ "alias": "react-native-clippathview"
65
59
  }
66
60
  }
@@ -0,0 +1,30 @@
1
+ # react-native-clippath.podspec
2
+
3
+ require "json"
4
+
5
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
6
+
7
+ Pod::Spec.new do |s|
8
+ s.name = "react-native-clippath"
9
+ s.version = package["version"]
10
+ s.summary = package["description"]
11
+ s.description = <<-DESC
12
+ ClipPath IOS
13
+ DESC
14
+ s.homepage = "https://github.com/Only-IceSoul/react-native-clippath"
15
+ # brief license entry:
16
+ s.license = "MIT"
17
+ # optional - use expanded license entry instead:
18
+ # s.license = { :type => "MIT", :file => "LICENSE" }
19
+ s.authors = { "Your Name" => "yourname@email.com" }
20
+ s.platforms = { :ios => "10.0" }
21
+ s.source = { :git => "https://github.com/Only-IceSoul/react-native-clippath.git", :tag => "#{s.version}" }
22
+
23
+ s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
24
+ s.requires_arc = true
25
+
26
+ s.dependency "React"
27
+ # ...
28
+ # s.dependency "..."
29
+ end
30
+
File without changes