@dra2020/baseclient 1.0.31 → 1.0.32

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.
@@ -6,9 +6,21 @@ export function polyContainsPoint(poly: any, x: number, y: number): boolean
6
6
  if (pp == null) return false;
7
7
  let bFound = false;
8
8
  let bInside = false;
9
+ let iCurPoly = -1;
10
+ let bCurInside = false;
9
11
 
10
12
  PP.polyPackEachRing(pp, (b: Float64Array, iPoly: number, iRing: number, iOffset: number, nPoints: number) => {
11
13
  if (bFound) return;
14
+ if (iRing == 0)
15
+ {
16
+ if (iCurPoly >= 0 && bCurInside)
17
+ {
18
+ bInside = true;
19
+ bFound = true;
20
+ }
21
+ iCurPoly = iPoly;
22
+ bCurInside = false;
23
+ }
12
24
  let inside = false;
13
25
  let iEnd = iOffset + (nPoints - 1) * 2;
14
26
  for (let i = iOffset, j = iEnd; i <= iEnd; j = i, i += 2)
@@ -20,10 +32,9 @@ export function polyContainsPoint(poly: any, x: number, y: number): boolean
20
32
  if (intersect) inside = !inside;
21
33
  }
22
34
  if (inside)
23
- {
24
- bFound = iRing > 0; // if inside a hole, don't need to process further
25
- bInside = iRing == 0; // not inside if inside a hole
26
- }
35
+ bCurInside = iRing == 0; // not inside if inside a hole
27
36
  });
37
+ if (iCurPoly >= 0 && bCurInside)
38
+ bInside = true;
28
39
  return bInside;
29
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",