@@ -9,9 +9,10 @@ import {DeckGL} from '@deck.gl/react';
9
9
import { ScatterplotLayer } from '@deck.gl/layers' ;
10
10
11
11
import type { Color , MapViewState } from '@deck.gl/core' ;
12
+ import type { Device , DeviceProps } from '@luma.gl/core' ;
12
13
13
- const MALE_COLOR : Color = [ 0 , 128 , 255 ] ;
14
- const FEMALE_COLOR : Color = [ 255 , 0 , 128 ] ;
14
+ const MALE_COLOR : Color = [ 0 , 128 , 255 , 255 ] ;
15
+ const FEMALE_COLOR : Color = [ 255 , 0 , 128 , 255 ] ;
15
16
16
17
// Source data CSV
17
18
const DATA_URL =
@@ -29,12 +30,16 @@ const INITIAL_VIEW_STATE: MapViewState = {
29
30
type DataPoint = [ longitude : number , latitude : number , gender : number ] ;
30
31
31
32
export default function App ( {
33
+ device,
34
+ deviceProps,
32
35
data = DATA_URL ,
33
36
radius = 30 ,
34
37
maleColor = MALE_COLOR ,
35
38
femaleColor = FEMALE_COLOR ,
36
39
mapStyle = 'https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json'
37
40
} : {
41
+ device ?: Device ;
42
+ deviceProps ?: DeviceProps ;
38
43
data ?: string | DataPoint [ ] ;
39
44
radius ?: number ;
40
45
maleColor ?: Color ;
@@ -52,17 +57,24 @@ export default function App({
52
57
getRadius : 1 ,
53
58
updateTriggers : {
54
59
getFillColor : [ maleColor , femaleColor ]
55
- }
60
+ } ,
61
+ pickable : true
56
62
} )
57
63
] ;
58
64
59
65
return (
60
- < DeckGL layers = { layers } initialViewState = { INITIAL_VIEW_STATE } controller = { true } >
66
+ < DeckGL
67
+ device = { device }
68
+ deviceProps = { deviceProps }
69
+ layers = { layers }
70
+ initialViewState = { INITIAL_VIEW_STATE }
71
+ controller = { true }
72
+ >
61
73
< Map reuseMaps mapStyle = { mapStyle } />
62
74
</ DeckGL >
63
75
) ;
64
76
}
65
77
66
- export function renderToDOM ( container : HTMLDivElement ) {
67
- createRoot ( container ) . render ( < App /> ) ;
78
+ export function renderToDOM ( container : HTMLDivElement , device ?: Device , deviceProps ?: DeviceProps ) {
79
+ createRoot ( container ) . render ( < App deviceProps = { deviceProps } /> ) ;
68
80
}
0 commit comments