(stage: Stage, height: number, width: number, cubeCount: number, modifyConfig: PresenterConfig)
| 258 | } |
| 259 | |
| 260 | private setDeckProps(stage: Stage, height: number, width: number, cubeCount: number, modifyConfig: PresenterConfig) { |
| 261 | const config = deepMerge<PresenterConfig>(defaultPresenterConfig, modifyConfig); |
| 262 | const newBounds = this.isNewBounds(stage.view, height, width, cubeCount); |
| 263 | //let lightSettings = this.style.lightSettings[stage.view]; |
| 264 | const lightingMix = stage.view === '3d' ? 1.0 : 0.0; |
| 265 | let linearInterpolator: LinearInterpolator_Class<CubeLayerInterpolatedProps>; |
| 266 | //choose the current OrbitView viewstate if possible |
| 267 | let viewState = (this.deckgl.viewState && Object.keys(this.deckgl.viewState).length && this.deckgl.viewState.OrbitView) |
| 268 | //otherwise use the initial viewstate if any |
| 269 | || this.deckgl.props.viewState; |
| 270 | |
| 271 | if (!viewState || newBounds || config.shouldViewstateTransition && config.shouldViewstateTransition()) { |
| 272 | let newViewStateTarget = true; |
| 273 | if (config && config.onTargetViewState) { |
| 274 | const result = config.onTargetViewState(height, width); |
| 275 | height = result.height; |
| 276 | width = result.width; |
| 277 | if (result.newViewStateTarget !== undefined) { |
| 278 | newViewStateTarget = result.newViewStateTarget; |
| 279 | } |
| 280 | } |
| 281 | if (!viewState || newViewStateTarget) { |
| 282 | viewState = targetViewState(height, width, stage.view); |
| 283 | } |
| 284 | const oldCubeLayer = getCubeLayer(this.deckgl.props) as CubeLayer_Class; |
| 285 | if (oldCubeLayer) { |
| 286 | linearInterpolator = new LinearInterpolator(viewStateProps); |
| 287 | linearInterpolator.layerStartProps = { lightingMix: oldCubeLayer.props.lightingMix }; |
| 288 | linearInterpolator.layerEndProps = { lightingMix }; |
| 289 | viewState.transitionDuration = config.transitionDurations.view; |
| 290 | viewState.transitionEasing = easing; |
| 291 | viewState.transitionInterpolator = linearInterpolator; |
| 292 | } |
| 293 | if (stage.view === '2d') { |
| 294 | //lightSettings = this.style.lightSettings['3d']; |
| 295 | } |
| 296 | } |
| 297 | const guideLines = this._showGuides && box(0, 0, height, width, '#0f0', 1, true); |
| 298 | config.preLayer && config.preLayer(stage); |
| 299 | const layers = getLayers(this, config, stage, /*lightSettings*/null, lightingMix, linearInterpolator, guideLines); |
| 300 | const deckProps: Partial<DeckProps> = { |
| 301 | effects: lightingEffects(), |
| 302 | views: [new base.deck.OrbitView({ controller: base.deck.OrbitController })], |
| 303 | initialViewState: viewState, |
| 304 | layers, |
| 305 | }; |
| 306 | if (config && config.preStage) { |
| 307 | config.preStage(stage, deckProps); |
| 308 | } |
| 309 | requestAnimationFrame(() => this.deckgl.setProps({ |
| 310 | ...deckProps, |
| 311 | onAfterRender: () => { |
| 312 | if (this._afterRenderHandler) { |
| 313 | this._afterRenderHandler(); |
| 314 | } |
| 315 | }, |
| 316 | })); |
| 317 | delete stage.cubeData; |
no test coverage detected