File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 5858 "webpack-cli" : " ^5.1.4" ,
5959 "yargs" : " 3.10.0"
6060 },
61- "homepage" : " https://iiif-commons.github.io/manifesto-3d/" ,
6261 "dependencies" : {
6362 "@edsilv/http-status-codes" : " ^1.0.3" ,
6463 "@iiif/vocabulary" : " ^1.0.26" ,
64+ "color-string" : " 1.9" ,
6565 "isomorphic-unfetch" : " ^3.0.0" ,
6666 "lodash" : " ^4.17.21" ,
6767 "node-fetch" : " 2" ,
68+ "threejs-math" : " ^0.147" ,
6869 "unfetch" : " ^4.2.0" ,
69- "webpack" : " ^5.89.0" ,
70- "color-string" : " 1.9" ,
71- "threejs-math" : " ^0.147"
70+ "webpack" : " ^5.89.0"
7271 },
7372 "directories" : {
7473 "test" : " test"
Original file line number Diff line number Diff line change @@ -247,12 +247,10 @@ export class Canvas extends Resource {
247247 . map ( annotationPage => new AnnotationPage ( annotationPage , this . options ) ) as AnnotationPage [ ] ;
248248 if ( ! annotationPages . length ) return [ ] ;
249249
250- const annotations = annotationPages
251- . map ( page => page . getItems ( ) )
252- . flat ( )
253- . map ( annotation => new Annotation ( annotation , this . options ) ) ;
254-
255- return annotations ;
250+ const annotationsNested = annotationPages . map ( page => page . getItems ( ) ) as Annotation [ ] [ ] ;
251+ const annotationsFlat = flattenDeep ( annotationsNested ) as Annotation [ ] ;
252+
253+ return annotationsFlat . map ( annotation => new Annotation ( annotation , this . options ) ) ;
256254 }
257255
258256 getOtherContent ( ) : Promise < AnnotationList [ ] > {
Original file line number Diff line number Diff line change 66 ManifestResource ,
77 Color
88} from "./internal" ;
9+ // @ts -ignore
10+ import flattenDeep from "lodash/flattenDeep" ;
911
1012export class Scene extends ManifestResource {
1113 constructor ( jsonld : any , options : IManifestoOptions ) {
@@ -77,11 +79,9 @@ export class Scene extends ManifestResource {
7779 . map ( annotationPage => new AnnotationPage ( annotationPage , this . options ) ) as AnnotationPage [ ] ;
7880 if ( ! annotationPages . length ) return [ ] ;
7981
80- const annotations = annotationPages
81- . map ( page => page . getItems ( ) )
82- . flat ( )
83- . map ( annotation => new Annotation ( annotation , this . options ) ) ;
84-
85- return annotations ;
82+ const annotationsNested = annotationPages . map ( page => page . getItems ( ) ) as Annotation [ ] [ ] ;
83+ const annotationsFlat = flattenDeep ( annotationsNested ) as Annotation [ ] ;
84+
85+ return annotationsFlat . map ( annotation => new Annotation ( annotation , this . options ) ) ;
8686 }
8787}
You can’t perform that action at this time.
0 commit comments