File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import {DeckGL} from '@deck.gl/react';
9
9
import { LineLayer , ScatterplotLayer } from '@deck.gl/layers' ;
10
10
11
11
import type { PickingInfo , MapViewState } from '@deck.gl/core' ;
12
+ import { Device } from '@luma.gl/core' ;
12
13
13
14
// Source data CSV
14
15
const DATA_URL = {
@@ -56,12 +57,14 @@ export default function App({
56
57
airports = DATA_URL . AIRPORTS ,
57
58
flightPaths = DATA_URL . FLIGHT_PATHS ,
58
59
lineWidth = 3 ,
59
- mapStyle = MAP_STYLE
60
+ mapStyle = MAP_STYLE ,
61
+ device
60
62
} : {
61
63
airports ?: string | Airport [ ] ;
62
64
flightPaths ?: string | FlightPath [ ] ;
63
65
lineWidth ?: number ;
64
66
mapStyle ?: string ;
67
+ device ?: Device ;
65
68
} ) {
66
69
const layers = [
67
70
new ScatterplotLayer < Airport > ( {
@@ -92,13 +95,20 @@ export default function App({
92
95
const r = z / 10000 ;
93
96
return [ 255 * ( 1 - r * 2 ) , 128 * r , 255 * r , 255 * ( 1 - r ) ] ;
94
97
} ,
95
- getWidth : lineWidth ,
98
+ // TODO(ck): WebGPU does not support constant attributes, so force the line layer to
99
+ // generate a buffer with each value individually, otherwise it will not be updated properly.
100
+ getWidth : ( ) => lineWidth ,
101
+ updateTriggers : {
102
+ // then use update triggers so that the function will be re-evaluated when lineWidth changes
103
+ getWidth : [ lineWidth ]
104
+ } ,
96
105
pickable : true
97
106
} )
98
107
] ;
99
108
100
109
return (
101
110
< DeckGL
111
+ device = { device }
102
112
layers = { layers }
103
113
initialViewState = { INITIAL_VIEW_STATE }
104
114
controller = { true }
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ class LineDemo extends Component {
24
24
25
25
static code = `${ GITHUB_TREE } /examples/website/line` ;
26
26
27
+ static hasDeviceTabs = true ;
28
+
27
29
static parameters = {
28
30
width : {
29
31
displayName : 'Width' ,
@@ -62,6 +64,8 @@ class LineDemo extends Component {
62
64
return (
63
65
< App
64
66
{ ...otherProps }
67
+ key = { this . props . device ?. type }
68
+ device = { this . props . device }
65
69
flightPaths = { data && data [ 0 ] }
66
70
airports = { data && data [ 1 ] }
67
71
lineWidth = { params . width . value }
You can’t perform that action at this time.
0 commit comments