@deck.gl/react
Advanced tools
Comparing version
@@ -36,18 +36,21 @@ // deck.gl | ||
// and Deck update on the same schedule. | ||
_customRender: redrawReason => { | ||
// Save the dirty flag for later | ||
thisRef.redrawReason = redrawReason; | ||
// Viewport/view state is passed to child components as props. | ||
// If they have changed, we need to trigger a React rerender to update children props. | ||
const viewports = deck.getViewports(); | ||
if (thisRef.lastRenderedViewports !== viewports) { | ||
// Viewports have changed, update children props first. | ||
// This will delay the Deck canvas redraw till after React update (in useLayoutEffect) | ||
// so that the canvas does not get rendered before the child components update. | ||
thisRef.forceUpdate(); | ||
// TODO(ibgreen) - Hack to enable WebGPU as it needs to render quickly to avoid CanvasContext texture from going stale | ||
_customRender: props.deviceProps?.adapters?.[0]?.type === 'webgpu' | ||
? undefined | ||
: redrawReason => { | ||
// Save the dirty flag for later | ||
thisRef.redrawReason = redrawReason; | ||
// Viewport/view state is passed to child components as props. | ||
// If they have changed, we need to trigger a React rerender to update children props. | ||
const viewports = deck.getViewports(); | ||
if (thisRef.lastRenderedViewports !== viewports) { | ||
// Viewports have changed, update children props first. | ||
// This will delay the Deck canvas redraw till after React update (in useLayoutEffect) | ||
// so that the canvas does not get rendered before the child components update. | ||
thisRef.forceUpdate(); | ||
} | ||
else { | ||
redrawDeck(thisRef); | ||
} | ||
} | ||
else { | ||
redrawDeck(thisRef); | ||
} | ||
} | ||
}); | ||
@@ -54,0 +57,0 @@ return deck; |
@@ -6,3 +6,3 @@ { | ||
"type": "module", | ||
"version": "9.1.4", | ||
"version": "9.1.5", | ||
"publishConfig": { | ||
@@ -36,3 +36,2 @@ "access": "public" | ||
"sideEffects": false, | ||
"scripts": {}, | ||
"peerDependencies": { | ||
@@ -50,3 +49,3 @@ "@deck.gl/core": "^9.1.0", | ||
}, | ||
"gitHead": "92f3582b31ce0886dff8a61278b42feb0f8fe5f0" | ||
"gitHead": "0223094f8c74c1db4a20bb9e5180b405d0809732" | ||
} |
@@ -85,18 +85,22 @@ // deck.gl | ||
// and Deck update on the same schedule. | ||
_customRender: redrawReason => { | ||
// Save the dirty flag for later | ||
thisRef.redrawReason = redrawReason; | ||
// TODO(ibgreen) - Hack to enable WebGPU as it needs to render quickly to avoid CanvasContext texture from going stale | ||
_customRender: | ||
props.deviceProps?.adapters?.[0]?.type === 'webgpu' | ||
? undefined | ||
: redrawReason => { | ||
// Save the dirty flag for later | ||
thisRef.redrawReason = redrawReason; | ||
// Viewport/view state is passed to child components as props. | ||
// If they have changed, we need to trigger a React rerender to update children props. | ||
const viewports = deck.getViewports(); | ||
if (thisRef.lastRenderedViewports !== viewports) { | ||
// Viewports have changed, update children props first. | ||
// This will delay the Deck canvas redraw till after React update (in useLayoutEffect) | ||
// so that the canvas does not get rendered before the child components update. | ||
thisRef.forceUpdate(); | ||
} else { | ||
redrawDeck(thisRef); | ||
} | ||
} | ||
// Viewport/view state is passed to child components as props. | ||
// If they have changed, we need to trigger a React rerender to update children props. | ||
const viewports = deck.getViewports(); | ||
if (thisRef.lastRenderedViewports !== viewports) { | ||
// Viewports have changed, update children props first. | ||
// This will delay the Deck canvas redraw till after React update (in useLayoutEffect) | ||
// so that the canvas does not get rendered before the child components update. | ||
thisRef.forceUpdate(); | ||
} else { | ||
redrawDeck(thisRef); | ||
} | ||
} | ||
}); | ||
@@ -103,0 +107,0 @@ return deck; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
125898
1.07%1715
0.53%