@olenbetong/synergi-react 4.1.2 → 4.1.3

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.
@@ -177,8 +177,11 @@ function groupLines(segments, minDim) {
177
177
  let lines = [];
178
178
  let maxAngle = (3 * Math.PI) / 180;
179
179
  let maxOffset = minDim * 0.015;
180
- for (let i = 0; i < segments.rows; i++) {
181
- let [x1, y1, x2, y2] = segments.data32S.slice(i * 4, i * 4 + 4);
180
+ // Count from the data, not `rows`: OpenCV 4 returns an N×1 matrix of segments and
181
+ // OpenCV 5 a 1×N one, and the loader may end up with either build.
182
+ let data = segments.data32S;
183
+ for (let i = 0; i + 3 < data.length; i += 4) {
184
+ let [x1, y1, x2, y2] = data.subarray(i, i + 4);
182
185
  let len = Math.hypot(x2 - x1, y2 - y1);
183
186
  // Normal of the segment, folded into [0, π)
184
187
  let theta = Math.atan2(x1 - x2, y2 - y1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/synergi-react",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "Standalone React component for SynergiWeb and Partner Portal",
5
5
  "type": "module",
6
6
  "exports": {
@@ -54,11 +54,11 @@
54
54
  "react-dom": "19.3.0",
55
55
  "react-pdf": "10.5.0",
56
56
  "zxing-wasm": "3.1.4",
57
- "@olenbetong/appframe-ds": "1.3.0",
58
57
  "@olenbetong/appframe-core": "2.14.0",
59
58
  "@olenbetong/appframe-data": "1.7.2",
60
59
  "@olenbetong/appframe-mui": "7.0.3",
61
- "@olenbetong/appframe-react": "2.2.1"
60
+ "@olenbetong/appframe-react": "2.2.1",
61
+ "@olenbetong/appframe-ds": "1.3.0"
62
62
  },
63
63
  "repository": {
64
64
  "type": "git",
@@ -203,8 +203,11 @@ function groupLines(segments: any, minDim: number): { vertical: Line[]; horizont
203
203
  let maxAngle = (3 * Math.PI) / 180;
204
204
  let maxOffset = minDim * 0.015;
205
205
 
206
- for (let i = 0; i < segments.rows; i++) {
207
- let [x1, y1, x2, y2] = segments.data32S.slice(i * 4, i * 4 + 4);
206
+ // Count from the data, not `rows`: OpenCV 4 returns an N×1 matrix of segments and
207
+ // OpenCV 5 a 1×N one, and the loader may end up with either build.
208
+ let data: Int32Array = segments.data32S;
209
+ for (let i = 0; i + 3 < data.length; i += 4) {
210
+ let [x1, y1, x2, y2] = data.subarray(i, i + 4);
208
211
  let len = Math.hypot(x2 - x1, y2 - y1);
209
212
  // Normal of the segment, folded into [0, π)
210
213
  let theta = Math.atan2(x1 - x2, y2 - y1);