-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Hello, I realize the OrthographicView and OrbitView are experimental, but maybe this provides a use case to be aware of.
<html lang="en">
<body>
<script src="https://unpkg.com/deck.gl@~5.2.0-beta/deckgl.min.js"></script>
<div id="div1" style="height: 500px;"></div>
<button onclick="toggle3D()">toggle 2D / 3D</button>
<script>
var is3D = true; //set this to false, then mouse will not control the orbit
function triangle(d, elevation, fillColor) {
return { polygon: [[0, 0], [d, 0], [0, d]], elevation, fillColor };
}
function createPolygonLayer() {
return new deck.PolygonLayer({
coordinateSystem: deck.COORDINATE_SYSTEM.IDENTITY,
data: [
triangle(100, 22, [0, 0, 255]), //blue
triangle(-100, 22, [255, 0, 0]) //red
],
extruded: is3D,
stroked: false
});
}
var views = {
false: {
view: new deck.OrthographicView({ top: -200, left: -200, height: 400, width: 400 }),
state: {}
},
true: {
view: new deck.OrbitView(),
state: { distance: 50, rotationX: 64, rotationOrbit: 72, fov: 50, zoom: 0.2 }
}
};
var deckgl = new deck.DeckGL({
views: [views[is3D].view],
viewState: views[is3D].state,
container: 'div1',
layers: [createPolygonLayer()]
});
function toggle3D() {
is3D = !is3D;
deckgl.setProps({
views: [views[is3D].view],
viewState: views[is3D].state,
layers: [createPolygonLayer()]
});
}
</script>
</body>
</html>Press the toggle 2D / 3D button.
Actual Result
When deck.DeckGL is initialized with an OrthographicView, the canvas will not respond to mouse events after the view is replaced with an OrbitView.
Expected Result
Mouse events to always be captured in OrbitView.
Reproduce Steps
Changing to var is3D = false; to initialize with 2D and see the error when in 3D.
volkantac
Metadata
Metadata
Assignees
Labels
No labels