Skip to content

Commit 651d140

Browse files
Add orthographic split view to widgets infovis demo (#9836)
1 parent 5b2325d commit 651d140

File tree

1 file changed

+40
-3
lines changed
  • test/apps/widgets-infovis

1 file changed

+40
-3
lines changed

test/apps/widgets-infovis/app.ts

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
// SPDX-License-Identifier: MIT
33
// Copyright (c) vis.gl contributors
44

5-
import {Deck, OrbitView, OrbitViewState} from '@deck.gl/core';
5+
import {
6+
Deck,
7+
OrbitView,
8+
OrbitViewState,
9+
OrthographicView,
10+
OrthographicViewState
11+
} from '@deck.gl/core';
612
import {ScatterplotLayer} from '@deck.gl/layers';
713
import {
814
GimbalWidget,
@@ -24,27 +30,58 @@ function generateData(count) {
2430
return result;
2531
}
2632

27-
const INITIAL_VIEW_STATE = {
33+
const INITIAL_ORBIT_VIEW_STATE = {
2834
target: [0, 0, 0],
2935
rotationX: 45,
3036
rotationOrbit: 0,
3137
zoom: 0
3238
} as const satisfies OrbitViewState;
3339

40+
const INITIAL_ORTHO_VIEW_STATE = {
41+
target: [0, 0, 0],
42+
zoom: 0
43+
} as const satisfies OrthographicViewState;
44+
45+
const INITIAL_VIEW_STATE = {
46+
'orbit-view': INITIAL_ORBIT_VIEW_STATE,
47+
'ortho-view': INITIAL_ORTHO_VIEW_STATE
48+
};
49+
50+
const ORTHOGRAPHIC_POINTS = [
51+
{position: [-40, -20, 0], color: [255, 99, 71]},
52+
{position: [-10, 30, 0], color: [65, 105, 225]},
53+
{position: [25, -5, 0], color: [60, 179, 113]},
54+
{position: [40, 35, 0], color: [238, 130, 238]}
55+
];
56+
3457
new Deck({
35-
views: new OrbitView({id: 'default-view'}),
58+
views: [
59+
new OrbitView({id: 'orbit-view', x: 0, width: '50%'}),
60+
new OrthographicView({id: 'ortho-view', x: '50%', width: '50%'})
61+
],
3662
initialViewState: INITIAL_VIEW_STATE,
3763
controller: true,
3864
layers: [
3965
new ScatterplotLayer({
4066
id: 'scatter',
67+
viewId: 'orbit-view',
4168
data: generateData(500),
4269
getPosition: d => d.position,
4370
getFillColor: d => d.color,
4471
getRadius: 3,
4572
pickable: true,
4673
autoHighlight: true,
4774
billboard: true
75+
}),
76+
new ScatterplotLayer({
77+
id: 'ortho-scatter',
78+
viewId: 'ortho-view',
79+
data: ORTHOGRAPHIC_POINTS,
80+
getPosition: d => d.position,
81+
getFillColor: d => d.color,
82+
getRadius: 8,
83+
pickable: true,
84+
autoHighlight: true
4885
})
4986
],
5087
widgets: [

0 commit comments

Comments
 (0)