@dra2020/baseclient 1.0.31 → 1.0.34

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.
@@ -96,7 +96,8 @@ export declare type LabelUpdate = {
96
96
  [name: string]: boolean | null;
97
97
  };
98
98
  export interface SessionUpdateProps {
99
- id: string;
99
+ id?: string;
100
+ ids?: string[];
100
101
  deleted?: boolean;
101
102
  published?: boolean;
102
103
  official?: boolean;
@@ -124,7 +124,8 @@ export type LabelUpdate = { [name: string]: boolean|null }
124
124
 
125
125
  export interface SessionUpdateProps
126
126
  {
127
- id: string;
127
+ id?: string;
128
+ ids?: string[];
128
129
  deleted?: boolean;
129
130
  published?: boolean;
130
131
  official?: boolean;
@@ -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
  }
@@ -349,7 +349,7 @@ export function featurePack(f: any, prepack?: PolyPack): any
349
349
  }
350
350
  return f.geometry.packed;
351
351
  }
352
- else if (f.type && f.type === 'FeatureCollection' && f.features)
352
+ else if (f && f.type === 'FeatureCollection' && f.features)
353
353
  {
354
354
  // Allocate one large buffer
355
355
  let nFloats: number = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.31",
3
+ "version": "1.0.34",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",