55// This configuration object determines which deck.gl classes are accessible in Playground
66
77// deck.gl
8- import { MapView , FirstPersonView , OrbitView , OrthographicView } from '@deck.gl/core' ;
8+ import { MapView , FirstPersonView , OrbitView , OrthographicView , View , Layer } from '@deck.gl/core' ;
99import { COORDINATE_SYSTEM } from '@deck.gl/core' ;
1010import * as Layers from '@deck.gl/layers' ;
1111import * as AggregationLayers from '@deck.gl/aggregation-layers' ;
@@ -22,10 +22,7 @@ import {CSVLoader} from '@loaders.gl/csv';
2222import { DracoWorkerLoader } from '@loaders.gl/draco' ;
2323import { Tiles3DLoader , CesiumIonLoader } from '@loaders.gl/3d-tiles' ;
2424
25- const LOADERS = [
26- CSVLoader ,
27- DracoWorkerLoader
28- ]
25+ const LOADERS = [ CSVLoader , DracoWorkerLoader ] ;
2926
3027// Note: deck already registers JSONLoader...
3128registerLoaders ( LOADERS ) ;
@@ -52,7 +49,7 @@ export const JSON_CONFIGURATION = {
5249 // community layer modules
5350 ...CommunityLayers ,
5451 ...EditableLayers ,
55- ...GraphLayers ,
52+ ...GraphLayers
5653 // ArrowLayers,
5754 } ,
5855
@@ -62,12 +59,26 @@ export const JSON_CONFIGURATION = {
6259 // Enumerations that should be available to JSON parser
6360 // Will be resolved as `<enum-name>.<enum-value>`
6461 enumerations : {
65- COORDINATE_SYSTEM ,
62+ COORDINATE_SYSTEM
6663 } ,
6764
6865 // Constants that should be resolved with the provided values by JSON converter
6966 constants : {
7067 Tiles3DLoader,
7168 CesiumIonLoader
69+ } ,
70+
71+ postProcessConvertedJson : ( json ) => {
72+ // Filter out invalid props. Typically, props will be invalid while the user is typing.
73+ if ( json . layers ) {
74+ json . layers = json . layers . filter ( ( layer ) => layer instanceof Layer ) ;
75+ }
76+ if ( json . widgets ) {
77+ json . widgets = json . widgets . filter ( ( widget ) => typeof widget . onAdd === 'function' ) ;
78+ }
79+ if ( json . views && ! ( json . views instanceof View ) ) {
80+ json . views = json . views . filter ( ( view ) => view instanceof View ) ;
81+ }
82+ return json ;
7283 }
7384} ;
0 commit comments