private setDeckProps()

in packages/vega-deck.gl/src/presenter.ts [260:325]


    private setDeckProps(stage: Stage, height: number, width: number, cubeCount: number, modifyConfig: PresenterConfig) {
        const config = deepMerge<PresenterConfig>(defaultPresenterConfig, modifyConfig);
        const newBounds = this.isNewBounds(stage.view, height, width, cubeCount);
        //let lightSettings = this.style.lightSettings[stage.view];
        let lightingMix = stage.view === '3d' ? 1.0 : 0.0;
        let linearInterpolator: LinearInterpolator_Class<CubeLayerInterpolatedProps>;
        //choose the current OrbitView viewstate if possible
        let viewState = (this.deckgl.viewState && Object.keys(this.deckgl.viewState).length && this.deckgl.viewState.OrbitView)
            //otherwise use the initial viewstate if any
            || this.deckgl.props.viewState;

        if (!viewState || newBounds || config.shouldViewstateTransition && config.shouldViewstateTransition()) {
            let newViewStateTarget = true;
            if (config && config.onTargetViewState) {
                const result = config.onTargetViewState(height, width);
                height = result.height;
                width = result.width;
                if (result.newViewStateTarget !== undefined) {
                    newViewStateTarget = result.newViewStateTarget;
                }
            }
            if (!viewState || newViewStateTarget) {
                viewState = targetViewState(height, width, stage.view);
            }
            const oldCubeLayer = getCubeLayer(this.deckgl.props) as CubeLayer_Class;
            if (oldCubeLayer) {
                linearInterpolator = new LinearInterpolator(viewStateProps);
                linearInterpolator.layerStartProps = { lightingMix: oldCubeLayer.props.lightingMix };
                linearInterpolator.layerEndProps = { lightingMix };
                viewState.transitionDuration = config.transitionDurations.view;
                viewState.transitionEasing = easing;
                viewState.transitionInterpolator = linearInterpolator;
            }
            if (stage.view === '2d') {
                //lightSettings = this.style.lightSettings['3d'];
            }
        }
        const guideLines = this._showGuides && box(0, 0, height, width, '#0f0', 1, true);
        config.preLayer && config.preLayer(stage);
        const layers = getLayers(this, config, stage, /*lightSettings*/null, lightingMix, linearInterpolator, guideLines);
        const deckProps: Partial<DeckProps> = {
            effects: lightingEffects(),
            views: [new base.deck.OrbitView({ controller: base.deck.OrbitController })],
            initialViewState: viewState,
            layers
        };
        if (config && config.preStage) {
            config.preStage(stage, deckProps);
        }
        requestAnimationFrame(() => this.deckgl.setProps({
            ...deckProps,
            onAfterRender: () => {
                if (this._afterRenderHandler) {
                    this._afterRenderHandler();
                }
            }
        }));
        delete stage.cubeData;
        this._last = {
            cubeCount,
            height,
            width,
            stage: stage,
            view: stage.view
        };
    }