File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @thatopen/fragments" ,
3
3
"description" : " Simple geometric system built on top of Three.js to display 3D BIM data efficiently." ,
4
- "version" : " 2.3.0-alpha.7 " ,
4
+ "version" : " 2.3.0-alpha.8 " ,
5
5
"author" : " That Open Company" ,
6
6
"contributors" : [
7
7
" Antonio Gonzalez Viegas (https://github.com/agviegas)" ,
Original file line number Diff line number Diff line change 1
1
import { FragmentIdMap } from "./base-types" ;
2
2
3
3
export class FragmentUtils {
4
- static combine ( maps : Iterable < FragmentIdMap > ) {
4
+ static combine ( maps : FragmentIdMap [ ] ) {
5
+ if ( maps . length === 0 ) {
6
+ return { } ;
7
+ }
8
+
9
+ if ( maps . length === 1 ) {
10
+ return maps [ 0 ] ;
11
+ }
12
+
5
13
const result : FragmentIdMap = { } ;
6
14
for ( const map of maps ) {
7
15
for ( const fragID in map ) {
@@ -16,10 +24,18 @@ export class FragmentUtils {
16
24
return result ;
17
25
}
18
26
19
- static intersect ( maps : Iterable < FragmentIdMap > ) {
27
+ static intersect ( maps : FragmentIdMap [ ] ) {
20
28
// Strategy: count all fragIDs and all IDs
21
29
// only stay with values whose count equals the maps count
22
30
31
+ if ( maps . length === 0 ) {
32
+ return { } ;
33
+ }
34
+
35
+ if ( maps . length === 1 ) {
36
+ return maps [ 0 ] ;
37
+ }
38
+
23
39
const visitedIDs = new Map <
24
40
string ,
25
41
{ count : number ; ids : Map < number , number > }
You can’t perform that action at this time.
0 commit comments