Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
fix(effects): fixes for effects regressions (#3376)
Igor Dykhta992f5016da06
diff --git a/src/components/src/effects/effect-configurator.tsx b/src/components/src/effects/effect-configurator.tsxindex 3086bc6a4..de58527af 100644--- a/src/components/src/effects/effect-configurator.tsx+++ b/src/components/src/effects/effect-configurator.tsx@@ -11,8 +11,10 @@ import {Effect, EffectUpdateProps} from '@kepler.gl/types';import RangeSliderFactory from '../common/range-slider';import {ArrowDownSmall} from '../common/icons';+import {Tooltip} from '../common/styled-components';import EffectTimeConfiguratorFactory from './effect-time-configurator';import CompactColorPicker from './compact-color-picker';+import SurfaceFogElevationSectionFactory, {ELEVATION_SECTION_TYPE} from './surface-fog-section';export type EffectConfiguratorProps = {effect: Effect;@@ -160,6 +162,35 @@ const StyledCheckboxLabel = styled.label`white-space: nowrap;`;+const StyledHintTooltip = styled(Tooltip)`+ &.__react_component_tooltip {+ max-width: 220px;+ white-space: normal;+ line-height: 1.4;+ text-align: left;+ }+`;++const StyledHintIcon = styled.span`+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 14px;+ height: 14px;+ margin-left: 6px;+ border-radius: 50%;+ font-size: 9px;+ font-weight: 600;+ line-height: 1;+ color: ${props => props.theme.labelColor};+ border: 1px solid ${props => props.theme.labelColor};+ cursor: help;+ &:hover {+ color: ${props => props.theme.textColorHl};+ border-color: ${props => props.theme.textColorHl};+ }+`;+const StyledColorCheckboxRow = styled.div`display: flex;align-items: center;@@ -178,17 +209,23 @@ type EffectParameterDescriptionFlattened = {name: string;type?: 'number' | 'array' | 'color' | 'checkbox';label?: string | false | (string | false)[];+ tooltip?: string;min: number;max: number;defaultValue?: number | number[] | boolean;index?: number;};-EffectConfiguratorFactory.deps = [RangeSliderFactory, EffectTimeConfiguratorFactory];+EffectConfiguratorFactory.deps = [+ RangeSliderFactory,+ EffectTimeConfiguratorFactory,+ SurfaceFogElevationSectionFactory+];export default function EffectConfiguratorFactory(RangeSlider: ReturnType<typeof RangeSliderFactory>,- EffectTimeConfigurator: ReturnType<typeof EffectTimeConfiguratorFactory>+ EffectTimeConfigurator: ReturnType<typeof EffectTimeConfiguratorFactory>,+ SurfaceFogElevationSection: ReturnType<typeof SurfaceFogElevationSectionFactory>): React.FC<EffectConfiguratorProps> {const ShadowEffectConfigurator: React.FC<EffectConfiguratorProps> = ({effect,@@ -198,17 +235,21 @@ export default function EffectConfiguratorFactory(const sliderProps = useMemo(() => {const propNames = ['shadowIntensity', 'ambientLightIntensity', 'sunLightIntensity'];+ const descriptions = effect.getParameterDescriptions();return propNames.map(propName => {+ const desc = descriptions.find(d => d.name === propName);+ const min = desc?.min ?? 0;+ const max = desc?.max ?? 1;return {value1: parameters[propName],- range: [0, 1],- value0: 0,+ range: [min, max],+ value0: min,onChange: (value: number[], event?: Event | null) => {updateEffectConfig(event, id, {parameters: {[propName]: value[1]}});}};});- }, [id, parameters, updateEffectConfig]);+ }, [id, effect, parameters, updateEffectConfig]);const onTimeParametersChanged = useCallback(parameters => {@@ -309,6 +350,8 @@ export default function EffectConfiguratorFactory(};const defaultUniforms = {};+ const ELEVATION_EXTRA_PARAMS = new Set(['heightEnd', 'animateHeight', 'linearEasing']);+const PostProcessingEffectConfigurator: React.FC<EffectConfiguratorProps> = ({effect,updateEffectConfig@@ -316,13 +359,21 @@ export default function EffectConfiguratorFactory(const uniforms = effect.deckEffect?.module.propTypes || defaultUniforms;const parameterDescriptions = effect.getParameterDescriptions();const {parameters, id} = effect;++ const hasElevationSection = parameterDescriptions.some(d => d.name === 'animateHeight');+const flatParameterDescriptions = useMemo(() => {return parameterDescriptions.reduce((acc, description) => {+ if (hasElevationSection && ELEVATION_EXTRA_PARAMS.has(description.name)) return acc;++ if (hasElevationSection && description.name === 'height') {+ acc.push({...description, type: ELEVATION_SECTION_TYPE as any});+ return acc;+ }+if (description.type === 'color') {- // color parameters are rendered separately via CompactColorPickeracc.push(description);} else if (description.type === 'array') {- // split arrays of controls into a separate controls for each componentif (Array.isArray(description.defaultValue)) {description.defaultValue.forEach((_, index) => {acc.push({@@ -338,10 +389,14 @@ export default function EffectConfiguratorFactory(return acc;}, [] as EffectParameterDescriptionFlattened[]);- }, [parameterDescriptions]);+ }, [parameterDescriptions, hasElevationSection]);const controls = useMemo(() => {return flatParameterDescriptions.map(desc => {+ if ((desc.type as string) === ELEVATION_SECTION_TYPE) {+ return {isElevationSection: true as const};+ }+if (desc.type === 'color') {return {isColor: true as const,@@ -354,11 +409,13 @@ export default function EffectConfiguratorFactory(}if (desc.type === 'checkbox') {+ const label = typeof desc.label === 'string' ? desc.label : desc.name;return {isCheckbox: true as const,- label: typeof desc.label === 'string' ? desc.label : desc.name,+ label,paramName: desc.name,checked: Boolean(parameters[desc.name]),+ tooltip: desc.tooltip,onChange: () =>updateEffectConfig(null, id, {parameters: {[desc.name]: !parameters[desc.name]}})};@@ -428,7 +485,6 @@ export default function EffectConfiguratorFactory(};}// Parameter defined in effect description but not in shader propTypes- // (e.g. user-facing props that the effect maps to different GLSL uniforms)else if (desc.min !== undefined && desc.max !== undefined) {const rangeSpan = desc.max - desc.min;const step = rangeSpan > 10 ? 1 : 0.001;@@ -464,6 +520,9 @@ export default function EffectConfiguratorFactory(if ('isColor' in control) {const nextControl = i + 1 < controls.length ? controls[i + 1] : null;if (nextControl && 'isCheckbox' in nextControl) {+ const cbTooltipId = nextControl.tooltip+ ? `effect-cb-hint-${effect.id}-${i}`+ : undefined;elements.push(<StyledColorCheckboxRow key={`${effect.id}-${i}`}><CompactColorPicker@@ -487,6 +546,20 @@ export default function EffectConfiguratorFactory(onClick={e => e.stopPropagation()}/><StyledCheckboxLabel>{nextControl.label}</StyledCheckboxLabel>+ {nextControl.tooltip ? (+ <>+ <StyledHintIcon+ data-tip+ data-for={cbTooltipId}+ onClick={e => e.stopPropagation()}+ >+ ?+ </StyledHintIcon>+ <StyledHintTooltip id={cbTooltipId} effect="solid" delayShow={200}>+ {nextControl.tooltip}+ </StyledHintTooltip>+ </>+ ) : null}</StyledCheckboxWrapper></StyledColorCheckboxRow>);@@ -533,6 +606,18 @@ export default function EffectConfiguratorFactory(continue;}+ if ('isElevationSection' in control) {+ elements.push(+ <SurfaceFogElevationSection+ key={`${effect.id}-elevation`}+ effect={effect}+ updateEffectConfig={updateEffectConfig}+ />+ );+ i++;+ continue;+ }+elements.push(<RegularOuterWrapper key={`${effect.id}-${i}`}>{control.label ? (@@ -545,6 +630,7 @@ export default function EffectConfiguratorFactory();i++;}+return elements;})()}</StyledEffectConfigurator>diff --git a/src/components/src/effects/surface-fog-section.tsx b/src/components/src/effects/surface-fog-section.tsxnew file mode 100644index 000000000..9cc39bafe--- /dev/null+++ b/src/components/src/effects/surface-fog-section.tsx@@ -0,0 +1,354 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import React, {useCallback, useMemo, useState} from 'react';+import styled from 'styled-components';++export const ELEVATION_SECTION_TYPE = 'elevation-section';++import {Effect, EffectParameterDescription, EffectUpdateProps} from '@kepler.gl/types';++import {VertThreeDots} from '../common/icons';+import {Tooltip} from '../common/styled-components';+import RangeSliderFactory from '../common/range-slider';++const StyledCollapsibleSectionHeader = styled.div`+ display: flex;+ align-items: center;+ justify-content: space-between;+ cursor: pointer;+ margin-bottom: 4px;+ &:hover {+ .effect-section__title {+ color: ${props => props.theme.textColorHl};+ }+ .effect-section__dots {+ color: ${props => props.theme.textColorHl};+ }+ }+`;++const StyledElevationSectionTitle = styled.div`+ border-left: ${props => props.theme.layerConfigGroupLabelBorderLeft} solid+ ${props => props.theme.labelColor};+ line-height: 12px;+ padding-left: ${props => props.theme.layerConfigGroupLabelPadding};+ font-size: ${props => props.theme.layerConfigGroupLabelLabelFontSize};+ color: ${props => props.theme.textColor};+ font-weight: 500;+ letter-spacing: 0.2px;+ text-transform: capitalize;+`;++const StyledDotsWrapper = styled.div`+ display: flex;+ align-items: center;+ color: ${props => props.theme.textColor};+`;++const StyledCollapsibleContent = styled.div<{$collapsed: boolean}>`+ overflow: hidden;+ max-height: ${props => (props.$collapsed ? '0' : '200px')};+ transition: max-height 0.3s ease-out;+ padding-left: ${props =>+ `calc(${props.theme.layerConfigGroupLabelBorderLeft} + ${props.theme.layerConfigGroupLabelPadding})`};+`;++const StyledDisabledSlider = styled.div<{$disabled: boolean}>`+ ${props =>+ props.$disabled+ ? `+ opacity: 0.3;+ pointer-events: none;+ `+ : ''}+`;++const RegularOuterWrapper = styled.div.attrs({+ className: 'effect-configurator__pp-section'+})`+ margin-bottom: 8px;+`;++const RegularSectionTitleWrapper = styled.div.attrs({+ className: 'effect-configurator__pp-section-title'+})`+ font-size: ${props => props.theme.inputFontSize};+ color: ${props => props.theme.effectPanelTextSecondary1};+ text-transform: capitalize;+ margin-bottom: -3px;+`;++const RegularSliderWrapper = styled.div.attrs({+ className: 'effect-configurator__pp-section-control'+})`+ height: 32px;+ .kg-range-slider__input {+ height: 32px;+ text-align: center;+ padding: 3px 6px;+ }+ .kg-slider {+ padding-left: 6px;+ }+ .kg-range-slider {+ padding: 0px !important;+ }+`;++const StyledCheckboxWrapper = styled.div.attrs({+ className: 'effect-configurator__pp-section-checkbox'+})`+ display: flex;+ align-items: center;+ cursor: pointer;+`;++const StyledCheckbox = styled.input`+ margin-right: 6px;+ cursor: pointer;+ accent-color: ${props => props.theme.activeColor};+`;++const StyledCheckboxLabel = styled.label`+ font-size: ${props => props.theme.inputFontSize};+ color: ${props => props.theme.effectPanelTextSecondary1};+ cursor: pointer;+ white-space: nowrap;+`;++const StyledHintTooltip = styled(Tooltip)`+ &.__react_component_tooltip {+ max-width: 220px;+ white-space: normal;+ line-height: 1.4;+ text-align: left;+ }+`;++const StyledHintIcon = styled.span`+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 14px;+ height: 14px;+ margin-left: 6px;+ border-radius: 50%;+ font-size: 9px;+ font-weight: 600;+ line-height: 1;+ color: ${props => props.theme.labelColor};+ border: 1px solid ${props => props.theme.labelColor};+ cursor: help;+ &:hover {+ color: ${props => props.theme.textColorHl};+ border-color: ${props => props.theme.textColorHl};+ }+`;++const COMMON_SLIDER_PROPS = {+ showInput: true,+ isRanged: false,+ step: 0.001,+ label: 'value'+};++export type SurfaceFogElevationSectionProps = {+ effect: Effect;+ updateEffectConfig: (+ e: Event | null | undefined,+ id: string,+ config: Partial<EffectUpdateProps>+ ) => void;+ RangeSlider: ReturnType<typeof RangeSliderFactory>;+};++SurfaceFogElevationSectionFactory.deps = [RangeSliderFactory];++export default function SurfaceFogElevationSectionFactory(+ RangeSlider: ReturnType<typeof RangeSliderFactory>+): React.FC<Omit<SurfaceFogElevationSectionProps, 'RangeSlider'>> {+ const SurfaceFogElevationSection: React.FC<+ Omit<SurfaceFogElevationSectionProps, 'RangeSlider'>+ > = ({effect, updateEffectConfig}) => {+ const {parameters, id} = effect;+ const parameterDescriptions = effect.getParameterDescriptions();++ const heightDesc = parameterDescriptions.find(+ (d: EffectParameterDescription) => d.name === 'height'+ );+ const heightEndDesc = parameterDescriptions.find(+ (d: EffectParameterDescription) => d.name === 'heightEnd'+ );+ const animateHeightDesc = parameterDescriptions.find(+ (d: EffectParameterDescription) => d.name === 'animateHeight'+ );+ const linearEasingDesc = parameterDescriptions.find(+ (d: EffectParameterDescription) => d.name === 'linearEasing'+ );++ const [elevationExpanded, setElevationExpanded] = useState(false);+ const onToggleElevationExpanded = useCallback(() => {+ setElevationExpanded(prev => !prev);+ }, []);++ const elevationControl = useMemo(() => {+ if (!heightDesc || !heightEndDesc) return null;++ const rangeMin = heightDesc.min ?? -200;+ const rangeMax = heightDesc.max ?? 3000;+ const rangeSpan = rangeMax - rangeMin;+ const step = rangeSpan > 10 ? 1 : 0.001;++ const endMin = heightEndDesc.min ?? rangeMin;+ const endMax = heightEndDesc.max ?? rangeMax;+ const endSpan = endMax - endMin;+ const endStep = endSpan > 10 ? 1 : 0.001;++ const isAnimateHeight = Boolean(parameters.animateHeight);++ return {+ label: heightDesc.label || heightDesc.name,+ value1: parameters.height ?? heightDesc.defaultValue ?? 0,+ value0: rangeMin,+ range: [rangeMin, rangeMax] as [number, number],+ step,+ onChange: (newValue: number[], event?: Event | null) => {+ updateEffectConfig(event, id, {parameters: {height: newValue[1]}});+ },+ animateChecked: isAnimateHeight,+ onAnimateChange: () => {+ const enabling = !parameters.animateHeight;+ const currentEnd = parameters.heightEnd ?? heightEndDesc.max ?? rangeMax;+ const currentHeight = parameters.height ?? heightDesc.defaultValue ?? 0;+ const updatedParams: Record<string, any> = {animateHeight: enabling};+ if (enabling && Math.abs(currentEnd - currentHeight) < 10) {+ updatedParams.heightEnd = rangeMax;+ }+ updateEffectConfig(null, id, {parameters: updatedParams});+ },+ endValue1: parameters.heightEnd ?? heightEndDesc.defaultValue ?? endMax,+ endValue0: endMin,+ endRange: [endMin, endMax] as [number, number],+ endStep,+ onEndChange: (newValue: number[], event?: Event | null) => {+ updateEffectConfig(event, id, {parameters: {heightEnd: newValue[1]}});+ },+ linearEasingChecked: Boolean(parameters.linearEasing),+ hasLinearEasing: Boolean(linearEasingDesc),+ onLinearEasingChange: () => {+ updateEffectConfig(null, id, {parameters: {linearEasing: !parameters.linearEasing}});+ },+ animateTooltip: animateHeightDesc?.tooltip,+ linearEasingTooltip: linearEasingDesc?.tooltip+ };+ }, [+ heightDesc,+ heightEndDesc,+ animateHeightDesc,+ linearEasingDesc,+ id,+ parameters,+ updateEffectConfig+ ]);++ if (!elevationControl) return null;++ const tooltipId = `effect-elevation-hint-${effect.id}`;+ const control = elevationControl;++ return (+ <RegularOuterWrapper>+ <StyledCollapsibleSectionHeader onClick={onToggleElevationExpanded}>+ <StyledElevationSectionTitle className="effect-section__title">+ Elevation+ </StyledElevationSectionTitle>+ <StyledDotsWrapper className="effect-section__dots">+ <VertThreeDots height="18px" />+ </StyledDotsWrapper>+ </StyledCollapsibleSectionHeader>+ <RegularSliderWrapper>+ <RangeSlider+ {...COMMON_SLIDER_PROPS}+ value1={control.value1 as number}+ value0={control.value0 as number}+ range={control.range}+ step={control.step}+ onChange={control.onChange}+ />+ </RegularSliderWrapper>+ <StyledCollapsibleContent $collapsed={!elevationExpanded}>+ <RegularOuterWrapper style={{marginTop: 8}}>+ <StyledCheckboxWrapper onClick={control.onAnimateChange}>+ <StyledCheckbox+ type="checkbox"+ checked={control.animateChecked}+ onChange={control.onAnimateChange}+ onClick={e => e.stopPropagation()}+ />+ <StyledCheckboxLabel>Animate elevation</StyledCheckboxLabel>+ {control.animateTooltip ? (+ <>+ <StyledHintIcon data-tip data-for={tooltipId} onClick={e => e.stopPropagation()}>+ ?+ </StyledHintIcon>+ <StyledHintTooltip id={tooltipId} effect="solid" delayShow={200}>+ {control.animateTooltip}+ </StyledHintTooltip>+ </>+ ) : null}+ </StyledCheckboxWrapper>+ </RegularOuterWrapper>+ <StyledDisabledSlider $disabled={!control.animateChecked}>+ <RegularSectionTitleWrapper>End elevation</RegularSectionTitleWrapper>+ <RegularSliderWrapper>+ <RangeSlider+ {...COMMON_SLIDER_PROPS}+ value1={control.endValue1 as number}+ value0={control.endValue0 as number}+ range={control.endRange}+ step={control.endStep}+ onChange={control.onEndChange}+ />+ </RegularSliderWrapper>+ </StyledDisabledSlider>+ {control.hasLinearEasing ? (+ <StyledDisabledSlider $disabled={!control.animateChecked}>+ <RegularOuterWrapper style={{marginTop: 4}}>+ <StyledCheckboxWrapper onClick={control.onLinearEasingChange}>+ <StyledCheckbox+ type="checkbox"+ checked={control.linearEasingChecked}+ onChange={control.onLinearEasingChange}+ onClick={e => e.stopPropagation()}+ />+ <StyledCheckboxLabel>Linear easing</StyledCheckboxLabel>+ {control.linearEasingTooltip ? (+ <>+ <StyledHintIcon+ data-tip+ data-for={`effect-linear-hint-${effect.id}`}+ onClick={e => e.stopPropagation()}+ >+ ?+ </StyledHintIcon>+ <StyledHintTooltip+ id={`effect-linear-hint-${effect.id}`}+ effect="solid"+ delayShow={200}+ >+ {control.linearEasingTooltip}+ </StyledHintTooltip>+ </>+ ) : null}+ </StyledCheckboxWrapper>+ </RegularOuterWrapper>+ </StyledDisabledSlider>+ ) : null}+ </StyledCollapsibleContent>+ </RegularOuterWrapper>+ );+ };++ return SurfaceFogElevationSection;+}diff --git a/src/components/src/index.ts b/src/components/src/index.tsindex caf86299e..fc632d03e 100644--- a/src/components/src/index.ts+++ b/src/components/src/index.ts@@ -347,6 +347,7 @@ export {default as LayerTypeDropdownListFactory} from './side-panel/layer-panel/export {default as LayerTypeSelectorFactory} from './side-panel/layer-panel/layer-type-selector';export {default as EffectConfiguratorFactory} from './effects/effect-configurator';+export {default as SurfaceFogElevationSectionFactory} from './effects/surface-fog-section';export {default as EffectListFactory} from './effects/effect-list';export {default as EffectManagerFactory} from './effects/effect-manager';export {default as EffectTimeConfiguratorFactory} from './effects/effect-time-configurator';diff --git a/src/components/src/loading-indicator.tsx b/src/components/src/loading-indicator.tsxindex b3ca6900f..056f1a223 100644--- a/src/components/src/loading-indicator.tsx+++ b/src/components/src/loading-indicator.tsx@@ -9,6 +9,7 @@ import {getNumRasterTilesBeingLoaded, getNumVectorTilesBeingLoaded} from '@kepletype StyledContainerProps = {$isVisible?: boolean;$left: number;+ $bottomOffset: number;};const spin = keyframes`@@ -31,7 +32,7 @@ const Spinner = styled.div`export const StyledContainer = styled.div<StyledContainerProps>`position: absolute;left: ${props => props.$left}px;- bottom: ${props => props.theme.sidePanel.margin.left}px;+ bottom: ${props => props.theme.sidePanel.margin.left + props.$bottomOffset}px;z-index: 1;color: ${props => props.theme.textColor};opacity: ${props => (props.$isVisible ? 1 : 0)};@@ -51,6 +52,7 @@ type LoadingIndicatorProps = {isVisible?: boolean;activeSidePanel?: boolean;sidePanelWidth?: number;+ hasAttributionLogos?: boolean;};/** Extra adjustment for the loading indicator when side panel is visible */@@ -60,11 +62,13 @@ const LoadingIndicator: React.FC<LoadingIndicatorProps & {theme: any}> = ({isVisible,activeSidePanel,sidePanelWidth,+ hasAttributionLogos,theme}) => {const left =(activeSidePanel ? (sidePanelWidth || 0) + LEFT_POSITION_ADJUSTMENT : 0) +theme.sidePanel.margin.left;+ const bottomOffset = hasAttributionLogos ? 24 : 0;// Helper message to track number of tiles that are being loadedconst numRasterTilesInProgress = getNumRasterTilesBeingLoaded();@@ -98,7 +102,7 @@ const LoadingIndicator: React.FC<LoadingIndicatorProps & {theme: any}> = ({const displayMessage = isVisible ? extraMessage : lastMessageRef.current;return (- <StyledContainer $isVisible={isVisible} $left={left}>+ <StyledContainer $isVisible={isVisible} $left={left} $bottomOffset={bottomOffset}><Spinner /><span>{`Loading... ${displayMessage}`}</span></StyledContainer>diff --git a/src/components/src/map-container.tsx b/src/components/src/map-container.tsxindex 5af17326b..26576a66f 100644--- a/src/components/src/map-container.tsx+++ b/src/components/src/map-container.tsx@@ -3,7 +3,7 @@// librariesimport React, {Component, createRef, useMemo} from 'react';-import styled, {withTheme} from 'styled-components';+import styled, {withTheme, useTheme} from 'styled-components';import {Map, MapRef} from 'react-map-gl';import {PickingInfo, MapView} from '@deck.gl/core';import DeckGL from '@deck.gl/react';@@ -304,15 +304,16 @@ export const Attribution: React.FC<AttributionProps> = ({return memoizedComponents;};-const StyledAttributionLogoContainer = styled.div`+const StyledAttributionLogoContainer = styled.div<{$left: number}>`position: absolute;- bottom: 4px;- left: 4px;+ bottom: ${props => props.theme.sidePanel.margin.left}px;+ left: ${props => props.$left}px;z-index: 1;display: flex;align-items: flex-end;gap: 4px;pointer-events: auto;+ transition: left 250ms ease-in-out;`;const StyledLogoLink = styled.a<{$enabled: boolean}>`@@ -323,12 +324,25 @@ const StyledLogoLink = styled.a<{$enabled: boolean}>`type AttributionLogosProps = {logos: AttributionWithStyle[];+ activeSidePanel?: boolean;+ sidePanelWidth?: number;};-export const AttributionLogos: React.FC<AttributionLogosProps> = ({logos}) => {+const LOGO_LEFT_ADJUSTMENT = 3;++export const AttributionLogos: React.FC<AttributionLogosProps> = ({+ logos,+ activeSidePanel,+ sidePanelWidth+}) => {+ const theme = useTheme() as any;+ const left =+ (activeSidePanel ? (sidePanelWidth || 0) + LOGO_LEFT_ADJUSTMENT : 0) ++ theme.sidePanel.margin.left;+if (!logos?.length) return null;return (- <StyledAttributionLogoContainer>+ <StyledAttributionLogoContainer $left={left}>{logos.map((logo, idx) => (<StyledLogoLinkkey={logo.logoUrl || idx}@@ -947,7 +961,9 @@ export default function MapContainerFactory(const views = deckGlProps?.views? deckGlProps?.views()- : new MapView({legacyMeterSizes: true} as ConstructorParameters<typeof MapView>[0] & {+ : new MapView({legacyMeterSizes: true, farZMultiplier: 1.2} as ConstructorParameters<+ typeof MapView+ >[0] & {legacyMeterSizes: boolean;});@@ -1275,6 +1291,7 @@ export default function MapContainerFactory(isVisible={Boolean(isLoadingIndicatorVisible || this.anyActiveLayerLoading)}activeSidePanel={Boolean(activeSidePanel)}sidePanelWidth={sidePanelWidth}+ hasAttributionLogos={attributionLogos.length > 0}/>) : null}{this.props.primary ? (@@ -1286,7 +1303,11 @@ export default function MapContainerFactory(/>) : null}{this.props.primary ? (- <AttributionLogos logos={attributionLogos} />+ <AttributionLogos+ logos={attributionLogos}+ activeSidePanel={Boolean(activeSidePanel)}+ sidePanelWidth={sidePanelWidth}+ />) : null}</>);diff --git a/src/components/src/modals/export-video-modal.spec.tsx b/src/components/src/modals/export-video-modal.spec.tsxindex da345b009..1e34021be 100644--- a/src/components/src/modals/export-video-modal.spec.tsx+++ b/src/components/src/modals/export-video-modal.spec.tsx@@ -271,6 +271,113 @@ describe('ExportVideoModal', () => {});});+ describe('surface fog height animation', () => {+ function makeFogDeckEffect() {+ const effect = {+ id: 'surface-fog-deck',+ props: {height: 50},+ postRender: jest.fn(),+ setProps: jest.fn(function (newProps) {+ Object.assign(effect.props, newProps);+ })+ };+ return effect;+ }++ function makeSurfaceFogEffect(deckEffect, overrides = {}) {+ const effect = {+ id: 'fog-1',+ type: 'surfaceFog',+ isEnabled: true,+ parameters: {+ height: 50,+ animateHeight: true,+ heightEnd: 200,+ linearEasing: false,+ ...overrides+ },+ deckEffect,+ clone: jest.fn()+ };+ // clone returns a fresh reference that still points to the same deckEffect+ effect.clone.mockImplementation(() => ({...effect, clone: effect.clone}));+ return effect;+ }++ function propsWithFogEffect(fogEffect) {+ return {+ ...DEFAULT_PROPS,+ visState: {+ ...DEFAULT_PROPS.visState,+ effects: [fogEffect],+ effectOrder: [fogEffect.id]+ }+ };+ }++ test('patches deckEffect.postRender when animateHeight is enabled', async () => {+ const deckEffect = makeFogDeckEffect();+ const originalPostRender = deckEffect.postRender;+ const fogEffect = makeSurfaceFogEffect(deckEffect);+ mockComputeDeckEffects.mockReturnValue([deckEffect]);++ await renderAndWaitForPanel(propsWithFogEffect(fogEffect));++ expect(deckEffect.postRender).not.toBe(originalPostRender);+ });++ test('restores original height when hubble is not playing', async () => {+ const deckEffect = makeFogDeckEffect();+ deckEffect.props.height = 75;+ const fogEffect = makeSurfaceFogEffect(deckEffect, {height: 75});+ mockComputeDeckEffects.mockReturnValue([deckEffect]);++ await renderAndWaitForPanel(propsWithFogEffect(fogEffect));++ // Call the patched postRender without hubble playing+ deckEffect.postRender.call(deckEffect, {});++ // Not playing → height resets to originalHeight+ expect(deckEffect.props.height).toBe(75);+ });++ test('does not mutate height when animateHeight is disabled', async () => {+ const deckEffect = makeFogDeckEffect();+ const fogEffect = makeSurfaceFogEffect(deckEffect, {animateHeight: false});+ mockComputeDeckEffects.mockReturnValue([deckEffect]);++ await renderAndWaitForPanel(propsWithFogEffect(fogEffect));++ deckEffect.props.height = 42;+ deckEffect.postRender.call(deckEffect, {});++ // ref.active is false so height should not be touched+ expect(deckEffect.props.height).toBe(42);+ });++ test('restores original postRender on unmount', async () => {+ const deckEffect = makeFogDeckEffect();+ const fogEffect = makeSurfaceFogEffect(deckEffect);+ mockComputeDeckEffects.mockReturnValue([deckEffect]);++ const {unmount} = await renderAndWaitForPanel(propsWithFogEffect(fogEffect));++ // postRender was patched (the wrapper function drives animation)+ const patchedPostRender = deckEffect.postRender;+ // Verify it's not the original mock (component binds and wraps it)+ expect(patchedPostRender).not.toBe(deckEffect.postRender.bind(deckEffect));++ unmount();++ // After unmount, postRender no longer drives animation.+ // The restored function is a bound copy of the original mock.+ deckEffect.props.height = 99;+ deckEffect.postRender.call(deckEffect, {});+ // Height should NOT be mutated by animation logic anymore+ expect(deckEffect.props.height).toBe(99);+ });+ });+describe('shadow compositing fallback', () => {const mockEffect = {id: 'light-shadow-1',diff --git a/src/components/src/modals/export-video-modal.tsx b/src/components/src/modals/export-video-modal.tsxindex ba8f28483..852965703 100644--- a/src/components/src/modals/export-video-modal.tsx+++ b/src/components/src/modals/export-video-modal.tsx@@ -29,6 +29,7 @@ import {getTimeRangeFilterKeyframes,getAnimatableFilters} from './hubble-utils';+import {useFogHeightAnimation} from './fog-height-animation';type HubbleModule = {ExportVideoPanelContainer: React.ComponentType<any>;@@ -40,12 +41,18 @@ let _hubblePromise: Promise<HubbleModule> | null = null;function loadHubble(): Promise<HubbleModule> {if (_hubbleModule) return Promise.resolve(_hubbleModule);- if (!_hubblePromise) {- _hubblePromise = import('@hubble.gl/react').then(mod => {+ if (_hubblePromise) return _hubblePromise;+ _hubblePromise = import('@hubble.gl/react').then(+ mod => {_hubbleModule = mod as unknown as HubbleModule;return _hubbleModule;- });- }+ },+ err => {+ // Allow retry on next call+ _hubblePromise = null;+ throw err;+ }+ );return _hubblePromise;}@@ -196,8 +203,6 @@ const HUBBLE_PANEL_OVERHEAD = 2 * 32 + 24 + 280;const EXPORT_VIDEO_MODAL_MAX_WIDTH = 1080;const MODAL_HORIZONTAL_PADDING = 144;-let _shadowCompositingEffect: InstanceType<typeof DeckShadowCompositingEffect> | null = null;-const ExportVideoModalFactory = () => {const ExportVideoModal: React.FC<ExportVideoModalProps> = ({mapboxApiAccessToken,@@ -212,22 +217,31 @@ const ExportVideoModalFactory = () => {onClose}) => {const [hubble, setHubble] = useState<HubbleModule | null>(_hubbleModule);+ const shadowCompositingRef = useRef<InstanceType<typeof DeckShadowCompositingEffect> | null>(+ null+ );useEffect(() => {patchDeckRendererForPostProcessing();}, []);+ const [hubbleError, setHubbleError] = useState<string | null>(null);+useEffect(() => {- if (!hubble) {- loadHubble().then(setHubble);+ if (!hubble && !hubbleError) {+ loadHubble()+ .then(setHubble)+ .catch(err => {+ setHubbleError(err?.message || 'Failed to load video export module');+ });}- }, [hubble]);+ }, [hubble, hubbleError]);useEffect(() => {return () => {- if (_shadowCompositingEffect) {- _shadowCompositingEffect.cleanup();- _shadowCompositingEffect = null;+ if (shadowCompositingRef.current) {+ shadowCompositingRef.current.cleanup();+ shadowCompositingRef.current = null;}};}, []);@@ -243,8 +257,9 @@ const ExportVideoModalFactory = () => {if (mapStyle?.styleType === NO_MAP_ID) {const noMapEntry = mapStyle.mapStyles?.[NO_MAP_ID];if (noMapEntry && !noMapEntry.url) {- const emptyStyleUrl =- 'data:application/json,' + encodeURIComponent(JSON.stringify(EMPTY_MAPBOX_STYLE));+ const emptyStyleUrl = `data:application/json,${encodeURIComponent(+ JSON.stringify(EMPTY_MAPBOX_STYLE)+ )}`;return {visState,mapState,@@ -277,6 +292,18 @@ const ExportVideoModalFactory = () => {(visState.effects || []).map((effect: Effect) => effect.clone()));+ const [videoConfiguration, setVideoConfiguration] = useState<VideoConfiguration>({+ ...exportVideo+ });+ const onUpdateVideoConfiguration = useCallback(+ (values: VideoConfiguration) => setVideoConfiguration(prev => ({...prev, ...values})),+ []+ );++ const hubbleContainerRef = useRef<any>(null);++ useFogHeightAnimation(videoEffects, hubbleContainerRef);+const deckEffects = useMemo(() => {if (videoEffects.length === 0) return [];const effectOrder = visState.effectOrder || videoEffects.map((e: Effect) => e.id);@@ -289,10 +316,10 @@ const ExportVideoModalFactory = () => {const hasShadow = effects.some((e: any) => e.shadow === true);const hasPostProcess = effects.some((e: any) => typeof e.postRender === 'function');if (hasShadow && !hasPostProcess) {- if (!_shadowCompositingEffect) {- _shadowCompositingEffect = new DeckShadowCompositingEffect();+ if (!shadowCompositingRef.current) {+ shadowCompositingRef.current = new DeckShadowCompositingEffect();}- effects.push(_shadowCompositingEffect as any);+ effects.push(shadowCompositingRef.current as any);}return effects;@@ -317,14 +344,6 @@ const ExportVideoModalFactory = () => {[keplerState, onViewChange, mapboxApiAccessToken, mapboxApiUrl]);- const [videoConfiguration, setVideoConfiguration] = useState<VideoConfiguration>({- ...exportVideo- });- const onUpdateVideoConfiguration = useCallback(- (values: VideoConfiguration) => setVideoConfiguration(prev => ({...prev, ...values})),- []- );-const trueDevicePixelRatio = useRef(typeof window !== 'undefined' ? window.devicePixelRatio : 1);@@ -351,13 +370,16 @@ const ExportVideoModalFactory = () => {}, []);const onFilterFrameUpdate = useCallback(- (filterIdx: number, name: string, value: any) =>- visStateActions.setFilterAnimationTime(filterIdx, name, value),+ (filterIdx: number, name: string, value: any) => {+ visStateActions.setFilterAnimationTime(filterIdx, name, value);+ },[visStateActions]);const onTripFrameUpdate = useCallback(- (value: any) => visStateActions.setLayerAnimationTime(value),+ (value: any) => {+ visStateActions.setLayerAnimationTime(value);+ },[visStateActions]);@@ -371,7 +393,20 @@ const ExportVideoModalFactory = () => {if (!hubble) {return (<StyledExportVideoModalContent className="export-video-modal">- <LoadingSpinner />+ {hubbleError ? (+ <div style={{padding: '20px', textAlign: 'center', color: '#d9534f'}}>+ <p>{hubbleError}</p>+ <Button+ onClick={() => {+ setHubbleError(null);+ }}+ >+ Retry+ </Button>+ </div>+ ) : (+ <LoadingSpinner />+ )}</StyledExportVideoModalContent>);}@@ -382,6 +417,7 @@ const ExportVideoModalFactory = () => {<KeplerUIContext.Provider value={KEPLER_UI}><StyledExportVideoModalContent className="export-video-modal"><ExportVideoPanelContainer+ ref={hubbleContainerRef}initialState={videoConfiguration}mapData={keplerState}onSettingsChange={onUpdateVideoConfiguration}diff --git a/src/components/src/modals/fog-height-animation.ts b/src/components/src/modals/fog-height-animation.tsnew file mode 100644index 000000000..ca42f95a4--- /dev/null+++ b/src/components/src/modals/fog-height-animation.ts@@ -0,0 +1,101 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import {useEffect, useMemo, useRef} from 'react';+import {SURFACE_FOG_TYPE} from '@kepler.gl/constants';+import {Effect} from '@kepler.gl/types';++type FogAnimState = {+ active: boolean;+ range: [number, number];+ originalHeight: number;+ linear: boolean;+};++/**+ * Drives the surface fog elevation animation during Hubble video export.+ *+ * Patches DeckSurfaceFogEffect.postRender to interpolate height per-frame+ * using the Hubble adapter's videoCapture.timeMs for precise sync.+ */+export function useFogHeightAnimation(+ videoEffects: Effect[],+ hubbleContainerRef: React.RefObject<any>+): void {+ const surfaceFogEffect = useMemo(+ () => videoEffects.find((e: Effect) => e.type === SURFACE_FOG_TYPE && e.isEnabled),+ [videoEffects]+ );++ const fogHeightAnim = useMemo(() => {+ if (!surfaceFogEffect?.parameters?.animateHeight) return null;+ const params = surfaceFogEffect.parameters;+ return {+ start: params.height as number,+ end: params.heightEnd as number,+ linear: Boolean(params.linearEasing)+ };+ }, [surfaceFogEffect]);++ const fogAnimRef = useRef<FogAnimState>({+ active: false,+ range: [0, 100],+ originalHeight: 50,+ linear: false+ });++ // Sync fogAnimRef config with effect parameters (don't start playing yet)+ useEffect(() => {+ if (fogHeightAnim) {+ fogAnimRef.current.active = true;+ fogAnimRef.current.range = [fogHeightAnim.start, fogHeightAnim.end];+ fogAnimRef.current.originalHeight = fogHeightAnim.start;+ fogAnimRef.current.linear = fogHeightAnim.linear;+ } else {+ if (fogAnimRef.current.active && surfaceFogEffect?.deckEffect) {+ surfaceFogEffect.deckEffect.setProps?.({height: fogAnimRef.current.originalHeight});+ }+ fogAnimRef.current.active = false;+ }+ }, [fogHeightAnim, surfaceFogEffect]);++ // Patch DeckSurfaceFogEffect.postRender to drive height animation per-frame.+ // Reads the Hubble adapter's videoCapture.timeMs to derive progress,+ // so our animation stays perfectly in sync with Hubble's own timeline.+ useEffect(() => {+ const de = surfaceFogEffect?.deckEffect;+ if (!de) return;+ const originalPostRender = de.postRender.bind(de);+ de.postRender = function (this: any, params: any) {+ const ref = fogAnimRef.current;+ if (ref.active) {+ const hubbleState = hubbleContainerRef.current?.state;+ const isPlaying = hubbleState?.previewing || hubbleState?.rendering;++ if (isPlaying) {+ const adapter = hubbleState?.adapter;+ const vc = adapter?.videoCapture;+ const tc = vc?.timecode;+ if (+ vc &&+ tc &&+ tc.duration > 0 &&+ Number.isFinite(vc.timeMs) &&+ Number.isFinite(tc.start)+ ) {+ const progress = Math.min(Math.max((vc.timeMs - tc.start) / tc.duration, 0), 1);+ const t = ref.linear ? progress : progress * progress * (3 - 2 * progress);+ const [s, e] = ref.range;+ this.props.height = s + (e - s) * t;+ }+ } else {+ this.props.height = ref.originalHeight;+ }+ }+ return originalPostRender(params);+ };+ return () => {+ de.postRender = originalPostRender;+ };+ }, [surfaceFogEffect, hubbleContainerRef]);+}diff --git a/src/components/src/modals/hubble-utils.ts b/src/components/src/modals/hubble-utils.tsindex c37743c6b..5da41b4e3 100644--- a/src/components/src/modals/hubble-utils.ts+++ b/src/components/src/modals/hubble-utils.ts@@ -181,7 +181,7 @@ export function getHubbleDeckGlProps(return {parameters: getHubbleParameters(keplerState),controller: true,- views: new MapView({})+ views: new MapView({farZMultiplier: 1.2})};}diff --git a/src/components/src/side-panel/layer-panel/layer-configurator.tsx b/src/components/src/side-panel/layer-panel/layer-configurator.tsxindex 46d351e4a..e2e6edd3b 100644--- a/src/components/src/side-panel/layer-panel/layer-configurator.tsx+++ b/src/components/src/side-panel/layer-panel/layer-configurator.tsx@@ -904,10 +904,7 @@ export default function LayerConfiguratorFactory({/* Interaction */}{'allowHover' in layer.visConfigSettings ? (<LayerConfigGroup label={'layer.interaction'} collapsible>- <VisConfigSwitch- {...layer.visConfigSettings.allowHover}- {...visConfiguratorProps}- />+ <VisConfigSwitch {...layer.visConfigSettings.allowHover} {...visConfiguratorProps} /></LayerConfigGroup>) : null}</StyledLayerVisualConfigurator>diff --git a/src/constants/src/default-settings.ts b/src/constants/src/default-settings.tsindex 5e6926ca8..ec325e17f 100644--- a/src/constants/src/default-settings.ts+++ b/src/constants/src/default-settings.ts@@ -1409,8 +1409,8 @@ export const LIGHT_AND_SHADOW_EFFECT: EffectDescription = {parameters: [{name: 'timestamp', min: 0, max: Number.MAX_SAFE_INTEGER},{name: 'shadowIntensity', min: 0, max: 1, defaultValue: DEFAULT_SHADOW_INTENSITY},- {name: 'sunLightIntensity', min: 0, max: 1, defaultValue: DEFAULT_LIGHT_INTENSITY},- {name: 'ambientLightIntensity', min: 0, max: 1, defaultValue: DEFAULT_LIGHT_INTENSITY},+ {name: 'sunLightIntensity', min: 0, max: 10, defaultValue: DEFAULT_LIGHT_INTENSITY},+ {name: 'ambientLightIntensity', min: 0, max: 10, defaultValue: DEFAULT_LIGHT_INTENSITY},{name: 'shadowColor', type: 'color', min: 0, max: 255, defaultValue: DEFAULT_SHADOW_COLOR},{name: 'sunLightColor', type: 'color', min: 0, max: 255, defaultValue: DEFAULT_LIGHT_COLOR},{name: 'ambientLightColor', type: 'color', min: 0, max: 255, defaultValue: DEFAULT_LIGHT_COLOR}@@ -1647,6 +1647,27 @@ export const POSTPROCESSING_EFFECTS: {[key: string]: EffectDescription} = {parameters: [{name: 'density', defaultValue: 0.6, min: 0, max: 1},{name: 'height', label: 'Elevation (m)', defaultValue: 50, min: -200, max: 3000},+ {+ name: 'animateHeight',+ type: 'checkbox',+ label: 'Animate Elevation',+ tooltip:+ 'Animates elevation from start to end value during video export preview and recording.',+ defaultValue: false,+ min: 0,+ max: 1+ },+ {name: 'heightEnd', label: 'End Elevation (m)', defaultValue: 100, min: -200, max: 3000},+ {+ name: 'linearEasing',+ type: 'checkbox',+ label: 'Linear Easing',+ tooltip:+ 'Uses constant speed instead of smooth ease-in / ease-out during elevation animation.',+ defaultValue: false,+ min: 0,+ max: 1+ },{name: 'thickness', label: 'Transition (m)', defaultValue: 50, min: 0, max: 1000},{name: 'fogColor',@@ -1659,7 +1680,8 @@ export const POSTPROCESSING_EFFECTS: {[key: string]: EffectDescription} = {{name: 'pattern',type: 'checkbox',- label: 'Show Pattern',+ label: 'Pattern',+ tooltip: 'Adds a noise pattern to the fog for a more natural, volumetric look.',defaultValue: false,min: 0,max: 1diff --git a/src/effects/src/custom-deck-lighting-effect.ts b/src/effects/src/custom-deck-lighting-effect.tsindex 1b90da48e..8412e2e4e 100644--- a/src/effects/src/custom-deck-lighting-effect.ts+++ b/src/effects/src/custom-deck-lighting-effect.ts@@ -4,6 +4,7 @@import {LightingEffect, shadow} from '@deck.gl/core';import type {Texture} from '@luma.gl/core';import type {ShaderModule} from '@luma.gl/shadertools';+import {patchTileViewportIds} from './tile-viewport-fix';/*** Exposes private members of LightingEffect that we need to access.@@ -11,7 +12,7 @@ import type {ShaderModule} from '@luma.gl/shadertools';*/interface LightingEffectPrivate {shadow: boolean;- shadowPasses: {delete(): void}[];+ shadowPasses: {delete(): void; render(params: Record<string, unknown>): void}[];dummyShadowMap: Texture | null;_createShadowPasses(device: unknown): void;}@@ -84,6 +85,7 @@ const CustomShadowModule = createCustomShadowModule();*/class CustomDeckLightingEffect extends LightingEffect {outputUniformShadow: boolean;+ isExportMode: boolean;private get _private(): LightingEffectPrivate {return this as unknown as LightingEffectPrivate;@@ -92,6 +94,7 @@ class CustomDeckLightingEffect extends LightingEffect {constructor(props) {super(props);this.outputUniformShadow = false;+ this.isExportMode = false;}setup(context) {@@ -104,6 +107,19 @@ class CustomDeckLightingEffect extends LightingEffect {}}+ preRender(opts) {+ if (!this._private.shadow) return;++ let unpatch: (() => void) | undefined;+ if (this.isExportMode) {+ unpatch = patchTileViewportIds(opts);+ }++ super.preRender(opts);++ unpatch?.();+ }+cleanup(context) {for (const shadowPass of this._private.shadowPasses) {shadowPass.delete();diff --git a/src/effects/src/shader-passes/distance-fog.ts b/src/effects/src/shader-passes/distance-fog.tsindex 436188c50..2c4fed180 100644--- a/src/effects/src/shader-passes/distance-fog.ts+++ b/src/effects/src/shader-passes/distance-fog.ts@@ -3,6 +3,7 @@import {ClipSpace} from '@luma.gl/engine';import type {ShaderModule} from '@luma.gl/shadertools';+import {patchTileViewportIds} from '../tile-viewport-fix';export type DistanceFogProps = {density: number;@@ -163,6 +164,7 @@ export class DeckDistanceFogEffect {id = 'distance-fog-effect';props: DistanceFogProps;module = distanceFogModule;+ isExportMode = false;private model: InstanceType<typeof ClipSpace> | null = null;constructor(props: Partial<DistanceFogProps> = {}) {@@ -198,10 +200,19 @@ export class DeckDistanceFogEffect {Object.assign(this.props, props);}- // eslint-disable-next-line @typescript-eslint/no-empty-function- preRender(): void {}+ private _unpatchViewports: (() => void) | null = null;++ preRender(opts?: any): void {+ if (this.isExportMode && opts) {+ this._unpatchViewports = patchTileViewportIds(opts);+ }+ }postRender(params: any): any {+ if (this._unpatchViewports) {+ this._unpatchViewports();+ this._unpatchViewports = null;+ }const {inputBuffer, swapBuffer, target} = params;const outputBuffer = target !== undefined ? target : swapBuffer;diff --git a/src/effects/src/shader-passes/surface-fog.ts b/src/effects/src/shader-passes/surface-fog.tsindex 1ef457a81..4088125fe 100644--- a/src/effects/src/shader-passes/surface-fog.ts+++ b/src/effects/src/shader-passes/surface-fog.ts@@ -3,6 +3,7 @@import {ClipSpace} from '@luma.gl/engine';import type {ShaderModule} from '@luma.gl/shadertools';+import {patchTileViewportIds} from '../tile-viewport-fix';export type SurfaceFogProps = {density: number;@@ -48,10 +49,9 @@ out vec4 fragColor;// --- Gradient noise for pattern detail ---vec2 hashGrad(vec2 p) {- vec2 k = vec2(0.3183099, 0.3678794);- p = p * k + k.yx;- vec2 h = fract(p.x * p.y * (p.x + p.y) * vec2(127.1, 311.7));- return normalize(h * 2.0 - 1.0);+ float h = dot(p, vec2(127.1, 311.7));+ float a = fract(sin(h) * 43758.5453) * 6.2831853;+ return vec2(cos(a), sin(a));}float noise2d(vec2 p) {@@ -69,10 +69,11 @@ float noise2d(vec2 p) {float fbm(vec2 p) {float v = 0.0;float a = 0.5;- mat2 rot = mat2(0.8, 0.6, -0.6, 0.8);+ // ~47.6° rotation per octave — avoids 45°/90° multiples that reinforce grid lines+ mat2 rot = mat2(0.6731, 0.7395, -0.7395, 0.6731);for (int i = 0; i < 3; i++) {v += a * noise2d(p);- p = rot * p * 2.0;+ p = rot * p * 2.03;a *= 0.5;}return v;@@ -295,6 +296,7 @@ export class DeckSurfaceFogEffect {id = 'surface-fog-effect';props: SurfaceFogProps;module = surfaceFogModule;+ isExportMode = false;private model: InstanceType<typeof ClipSpace> | null = null;constructor(props: Partial<SurfaceFogProps> = {}) {@@ -331,11 +333,19 @@ export class DeckSurfaceFogEffect {Object.assign(this.props, props);}- preRender(): void {- // no-op+ private _unpatchViewports: (() => void) | null = null;++ preRender(opts?: any): void {+ if (this.isExportMode && opts) {+ this._unpatchViewports = patchTileViewportIds(opts);+ }}postRender(params: any): any {+ if (this._unpatchViewports) {+ this._unpatchViewports();+ this._unpatchViewports = null;+ }const {inputBuffer, swapBuffer, target} = params;const outputBuffer = target !== undefined ? target : swapBuffer;diff --git a/src/effects/src/surface-fog-effect.ts b/src/effects/src/surface-fog-effect.tsindex 8ae8dc7ca..de9ce5ff6 100644--- a/src/effects/src/surface-fog-effect.ts+++ b/src/effects/src/surface-fog-effect.ts@@ -22,7 +22,8 @@ class SurfaceFogEffect extends Effect {}this.parameters = {...defaultParameters, ...this.parameters};- this.deckEffect = new DeckSurfaceFogEffect(this.parameters as SurfaceFogProps);+ const {animateHeight: _a, heightEnd: _h, linearEasing: _l, ...deckParams} = this.parameters;+ this.deckEffect = new DeckSurfaceFogEffect(deckParams as SurfaceFogProps);}getDefaultProps(props: EffectPropsPartial = {}) {@@ -33,7 +34,13 @@ class SurfaceFogEffect extends Effect {super.setProps(props);if (props.parameters) {- this.deckEffect?.setProps(this.parameters);+ const {+ animateHeight: _animateHeight,+ heightEnd: _heightEnd,+ linearEasing: _linearEasing,+ ...deckParams+ } = this.parameters;+ this.deckEffect?.setProps(deckParams);}}}diff --git a/src/effects/src/tile-viewport-fix.ts b/src/effects/src/tile-viewport-fix.tsnew file mode 100644index 000000000..ce70d3b65--- /dev/null+++ b/src/effects/src/tile-viewport-fix.ts@@ -0,0 +1,47 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++const noop = (): void => {+ /* no tiles patched */+};++/**+ * In interleaved (MapboxOverlay) mode during video export, deck.gl creates+ * two viewports per frame: 'MapView' and 'mapbox'. loaders.gl's Tileset3D+ * creates separate Tile3D trees per viewport, then merges selected tiles by+ * ID — the last viewport overwrites. Tile3D.updateVisibility sets viewportIds+ * to only the traversing viewport's ID (overwrite, not append) and guards+ * against re-entry within the same frame. The result: some tiles end up with+ * viewportIds=['MapView'] only. Tile3DLayer.filterSubLayer then rejects them+ * when a render pass uses viewport 'mapbox'.+ *+ * Fix: before any render pass that needs all tiles (shadow, fog, etc.),+ * ensure every tile sub-layer's tile has the pass viewport ID in its+ * viewportIds array. Returns a cleanup function that removes the added IDs+ * so they don't accumulate across frames.+ */+export function patchTileViewportIds(opts: {+ viewports?: {id: string}[];+ layers?: any[];+}): () => void {+ const viewportId = opts.viewports?.[0]?.id;+ if (!viewportId || !opts.layers) return noop;++ const patched: any[] = [];+ for (const layer of opts.layers) {+ const tile = (layer as any).props?.tile;+ if (tile?.viewportIds && tile.selected && !tile.viewportIds.includes(viewportId)) {+ tile.viewportIds.push(viewportId);+ patched.push(tile);+ }+ }++ return () => {+ for (const tile of patched) {+ const idx = tile.viewportIds.indexOf(viewportId);+ if (idx !== -1) {+ tile.viewportIds.splice(idx, 1);+ }+ }+ };+}diff --git a/src/layers/src/raster-tile/raster-tile-layer.ts b/src/layers/src/raster-tile/raster-tile-layer.tsindex ccc1ddc82..4dbe5187e 100644--- a/src/layers/src/raster-tile/raster-tile-layer.ts+++ b/src/layers/src/raster-tile/raster-tile-layer.ts@@ -74,11 +74,8 @@ import {default as KeplerLayer, LayerBaseConfigPartial} from '../base-layer';* Falls back to collection name or title when providers are absent.* Returns null when no meaningful attribution can be determined.*/-function extractSTACAttribution(- stac: CompleteSTACObject-): {title: string; url: string} | null {- const providers =- (stac as any).providers || (stac as any).properties?.providers;+function extractSTACAttribution(stac: CompleteSTACObject): {title: string; url: string} | null {+ const providers = (stac as any).providers || (stac as any).properties?.providers;if (Array.isArray(providers) && providers.length > 0) {const producer = providers.find(p => p.roles?.includes('producer'));const host = providers.find(p => p.roles?.includes('host'));@@ -88,10 +85,7 @@ function extractSTACAttribution(}}- const title =- (stac as any).title ||- (stac as any).properties?.title ||- (stac as any).collection;+ const title = (stac as any).title || (stac as any).properties?.title || (stac as any).collection;if (title && typeof title === 'string') {const selfLink = ((stac as any).links || []).find(l => l.rel === 'self');return {title, url: selfLink?.href || ''};diff --git a/src/layers/src/tile3d-layer/tile3d-layer.ts b/src/layers/src/tile3d-layer/tile3d-layer.tsindex 337edbe8d..b7ba0ed92 100644--- a/src/layers/src/tile3d-layer/tile3d-layer.ts+++ b/src/layers/src/tile3d-layer/tile3d-layer.ts@@ -2,9 +2,11 @@// Copyright contributors to the kepler.gl projectimport {Tile3DLayer as DeckTile3DLayer} from '@deck.gl/geo-layers';+import {LightingEffect as DeckLightingEffect} from '@deck.gl/core';import {Tiles3DLoader, CesiumIonLoader} from '@loaders.gl/3d-tiles';import {I3SLoader} from '@loaders.gl/i3s';import {Tileset3D, Tile3D} from '@loaders.gl/tiles';+import {parsePBRMaterial} from '@luma.gl/gltf';import Layer from '../base-layer';import Tile3DLayerIcon from './tile3d-layer-icon';@@ -23,6 +25,28 @@ import {VisConfigNumber, BindedLayerCallbacks} from '@kepler.gl/types';let _PatchedMeshLayer: any = null;let _PatchedScenegraphLayer: any = null;+/**+ * Returns true when the deck.gl instance has an active LightingEffect with+ * shadow rendering enabled (i.e. the kepler Light & Shadow effect is on).+ * Used by patched sub-layers to decide whether to override the material's+ * unlit flag: when no lighting effect is active, meshes stay unlit.+ */+function hasActiveLightingEffect(layer: any): boolean {+ const effects: any[] | undefined = layer.context?.deck?.props?.effects;+ if (!effects) return false;+ return effects.some(e => e instanceof DeckLightingEffect && (e as any).shadow);+}++/**+ * Same check but from the top-level KeplerTile3DLayer's own context.+ * Used in updateState to detect lighting on/off transitions.+ */+function _checkLightingActive(context: any): boolean {+ const effects: any[] | undefined = context?.deck?.props?.effects;+ if (!effects) return false;+ return effects.some(e => e instanceof DeckLightingEffect && (e as any).shadow);+}+/*** Custom DeckTile3DLayer that catches exceptions in _loadTileset and* _updateTileset (which calls selectTiles – an unhandled-promise path@@ -31,6 +55,43 @@ let _PatchedScenegraphLayer: any = null;*/// @ts-expect-error Types have separate declarations of a private property '_loadTileset'.class KeplerTile3DLayer extends DeckTile3DLayer {+ // deck.gl Tile3DLayer.updateState only sets `needsUpdate` on cached tile+ // sub-layers when `propsChanged` fires, but NOT when `extensionsChanged`+ // fires (e.g. the shadow module being added/removed). The LayerManager sets+ // `extensionsChanged` only on top-level layers, and it never reaches the+ // MeshLayer / ScenegraphLayer sub-layers inside the tile cache. Override+ // updateState to propagate the flag so every cached tile gets re-rendered+ // with the correct material (lit vs. unlit).+ //+ // Additionally, when the Light & Shadow effect is disabled (but kept in+ // the effects array to avoid cleanup/shader-module removal), no+ // extensionsChanged fires. Detect the lighting active→inactive transition+ // and force sublayer re-creation so models revert to their default (unlit)+ // materials.+ updateState(params: any): void {+ super.updateState(params);++ const lightingActive = _checkLightingActive(this.context);+ const prevLightingActive = (this.state as any)?._lightingWasActive ?? false;++ const lightingChanged = lightingActive !== prevLightingActive;+ if (lightingChanged) {+ this.setState({_lightingWasActive: lightingActive});+ }++ if (params.changeFlags.extensionsChanged || lightingChanged) {+ const {layerMap} = this.state as any;+ if (layerMap) {+ for (const key in layerMap) {+ const entry = layerMap[key];+ if (entry?.layer) {+ entry.layer.needsUpdate = true;+ }+ }+ }+ }+ }+// @ts-ignore override of private method called by deck.gl internalsprivate async _loadTileset(tilesetUrl: string) {try {@@ -94,12 +155,54 @@ class KeplerTile3DLayer extends DeckTile3DLayer {if (id === 'mesh') {if (!_PatchedMeshLayer) {_PatchedMeshLayer = class extends DefaultClass {+ shouldUpdateState(params) {+ if (super.shouldUpdateState(params)) return true;+ return hasActiveLightingEffect(this) !== (this.state?._lightingWasActive ?? false);+ }+updateState(params) {super.updateState(params);++ const lightingActive = hasActiveLightingEffect(this);+ const prevLighting = this.state?._lightingWasActive ?? false;+ if (lightingActive !== prevLighting) {+ this.setState({_lightingWasActive: lightingActive});+ // Re-parse the PBR material so that parseMaterial's+ // lit/unlit decision is re-evaluated with the new+ // lighting state. This updates shader inputs and+ // textures without rebuilding the entire GPU model.+ if (this.state?.model) {+ this.updatePbrMaterialUniforms(this.props.pbrMaterial);+ }+ }+if (params.changeFlags.extensionsChanged && this.state?.model) {this.updatePbrMaterialUniforms(this.props.pbrMaterial);}}++ // deck.gl MeshLayer.parseMaterial forces `unlit = true` whenever+ // the material has a baseColorTexture. This incorrectly disables+ // all lighting for textured I3S (ArcGIS) tiles. When the Light &+ // Shadow effect is active, respect the material's own `unlit`+ // property instead; otherwise fall back to the default (unlit) behavior.+ parseMaterial(material, mesh) {+ if (+ !hasActiveLightingEffect(this) ||+ !material ||+ !mesh?.attributes ||+ !mesh.attributes.normals+ ) {+ return super.parseMaterial(material, mesh);+ }+ const unlit = Boolean(material.unlit);+ return parsePBRMaterial(+ this.context.device,+ {unlit, ...material},+ {NORMAL: mesh.attributes.normals, TEXCOORD_0: mesh.attributes.texCoords},+ {pbrDebug: false, lights: true, useTangents: false}+ );+ }};(_PatchedMeshLayer as any).layerName = DefaultClass.layerName || 'MeshLayer';(_PatchedMeshLayer as any).defaultProps = DefaultClass.defaultProps;@@ -109,12 +212,59 @@ class KeplerTile3DLayer extends DeckTile3DLayer {if (id === 'scenegraph') {if (!_PatchedScenegraphLayer) {_PatchedScenegraphLayer = class extends DefaultClass {+ shouldUpdateState(params) {+ if (super.shouldUpdateState(params)) return true;+ return hasActiveLightingEffect(this) !== (this.state?._lightingWasActive ?? false);+ }++ _setUnlitOnModels(unlit: number) {+ const models = this.state?.models;+ if (!models) return;+ for (const model of models) {+ if (model.shaderInputs?.props?.pbrMaterial !== undefined) {+ model.shaderInputs.setProps({pbrMaterial: {unlit}});+ }+ }+ }+updateState(params) {super.updateState(params);++ const lightingActive = hasActiveLightingEffect(this);+ const prevLighting = this.state?._lightingWasActive ?? false;+ if (lightingActive !== prevLighting) {+ this.setState({_lightingWasActive: lightingActive});+ // When lighting is turned off, reset models to their+ // default unlit state (1); when turned on, enable+ // lighting (0). Avoids rebuilding the scenegraph.+ this._setUnlitOnModels(lightingActive ? 0 : 1);+ }++ // extensionsChanged fires when the shadow shader module is+ // added/removed from defaultShaderModules. Models must be+ // rebuilt so the new module is compiled into their shaders.if (params.changeFlags.extensionsChanged && this.state?.scenegraph) {this._updateScenegraph();}}++ // Google Photorealistic 3D Tiles (and some other glTF sources)+ // mark materials with KHR_materials_unlit, which causes the PBR+ // shader to skip all lighting. When the Light & Shadow effect is+ // active, override model options to force unlit=0 so that the+ // effect can influence the scene. Without the effect, keep the+ // default unlit behavior.+ _getModelOptions() {+ const opts = super._getModelOptions();+ if (!hasActiveLightingEffect(this)) {+ return opts;+ }+ opts.modelOptions = {+ ...opts.modelOptions,+ uniforms: {...(opts.modelOptions?.uniforms || {}), unlit: 0}+ };+ return opts;+ }};(_PatchedScenegraphLayer as any).layerName = DefaultClass.layerName || 'ScenegraphLayer';(_PatchedScenegraphLayer as any).defaultProps = DefaultClass.defaultProps;diff --git a/src/localization/src/translations/ca.ts b/src/localization/src/translations/ca.tsindex 58288afd7..0e77a0ade 100644--- a/src/localization/src/translations/ca.ts+++ b/src/localization/src/translations/ca.ts@@ -159,7 +159,8 @@ export default {fixedHeight: 'Alçada fixa',fixedHeightDescription: "Utilitzeu l'alçada sense modificacions",allowHover: "Mostra informació d'eina",- allowHoverDescription: "Mostra o oculta la informació d'eina en passar el cursor per sobre de les característiques de la capa"+ allowHoverDescription:+ "Mostra o oculta la informació d'eina en passar el cursor per sobre de les característiques de la capa"},layerManager: {addData: 'Afegeix Dades',diff --git a/src/localization/src/translations/es.ts b/src/localization/src/translations/es.tsindex abc449603..c9fd3151a 100644--- a/src/localization/src/translations/es.ts+++ b/src/localization/src/translations/es.ts@@ -160,7 +160,8 @@ export default {fixedHeight: 'Altura fija',fixedHeightDescription: 'Usar altura sin modificaciones',allowHover: 'Mostrar descripción emergente',- allowHoverDescription: 'Mostrar u ocultar información emergente al pasar el cursor sobre las características de la capa'+ allowHoverDescription:+ 'Mostrar u ocultar información emergente al pasar el cursor sobre las características de la capa'},layerManager: {addData: 'Añadir datos',diff --git a/src/localization/src/translations/fi.ts b/src/localization/src/translations/fi.tsindex f04b9fcdd..fea4a77c8 100644--- a/src/localization/src/translations/fi.ts+++ b/src/localization/src/translations/fi.ts@@ -157,7 +157,8 @@ export default {fixedHeight: 'Kiinteä korkeus',fixedHeightDescription: 'Käytä korkeutta ilman muutoksia',allowHover: 'Näytä työkaluvihje',- allowHoverDescription: 'Näytä tai piilota työkaluvihje, kun osoitin on tason ominaisuuksien päällä'+ allowHoverDescription:+ 'Näytä tai piilota työkaluvihje, kun osoitin on tason ominaisuuksien päällä'},layerManager: {addData: 'Lisää aineisto',diff --git a/src/localization/src/translations/pt.ts b/src/localization/src/translations/pt.tsindex 9640f8b77..aa1be3eb2 100644--- a/src/localization/src/translations/pt.ts+++ b/src/localization/src/translations/pt.ts@@ -158,7 +158,8 @@ export default {fixedHeight: 'Altura fixa',fixedHeightDescription: 'Use a altura sem modificações',allowHover: 'Mostrar dica de ferramenta',- allowHoverDescription: 'Mostrar ou ocultar dica de ferramenta ao passar o cursor sobre os recursos da camada'+ allowHoverDescription:+ 'Mostrar ou ocultar dica de ferramenta ao passar o cursor sobre os recursos da camada'},layerManager: {addData: 'Adicionar Dados',diff --git a/src/types/effects.d.ts b/src/types/effects.d.tsindex 3199e9b9e..d0aaec189 100644--- a/src/types/effects.d.ts+++ b/src/types/effects.d.ts@@ -5,6 +5,7 @@ type EffectParameterDescription = {name: string;type?: 'number' | 'array' | 'color' | 'checkbox';label?: string | false | (string | false)[];+ tooltip?: string;min: number;max: number;defaultValue?: number | number[] | boolean;diff --git a/src/utils/src/effect-utils.ts b/src/utils/src/effect-utils.tsindex 7cd6475fe..de168ebd4 100644--- a/src/utils/src/effect-utils.ts+++ b/src/utils/src/effect-utils.ts@@ -18,6 +18,7 @@ import {arrayMove} from '@kepler.gl/common-utils';import {MapState, Effect, EffectProps, EffectDescription} from '@kepler.gl/types';import {findById} from './utils';import {clamp} from './data-utils';+import {normalizeColor} from './color-utils';// TODO isolate types - depends on @kepler.gl/schemastype VisState = any;@@ -45,7 +46,35 @@ export function computeDeckEffects({.map(effectId => {const effect = findById(effectId)(visState.effects) as Effect | undefined;if (effect?.deckEffect) {+ // Always reset isExportMode so the flag doesn't persist from a+ // previous export session on reused effect instances.+ if (+ effect.type === LIGHT_AND_SHADOW_EFFECT.type ||+ effect.type === SURFACE_FOG_TYPE ||+ effect.type === DISTANCE_FOG_TYPE+ ) {+ effect.deckEffect.isExportMode = Boolean(isExport);+ }+if (effect.isEnabled) {+ // deck.gl's EffectManager matches effects by id and reuses old+ // instances (calling oldEffect.setProps(newEffect.props)) instead+ // of replacing them. When a lighting effect is removed and+ // re-added, the cached _lastLightingDeckEffect is the instance+ // that deck.gl will actually render with. Adopt it so that+ // parameter syncing in updateEffect targets the right object.+ if (+ !isExport &&+ effect.type === LIGHT_AND_SHADOW_EFFECT.type &&+ _lastLightingDeckEffect &&+ _lastLightingDeckEffect !== effect.deckEffect+ ) {+ const orphaned = effect.deckEffect;+ effect.deckEffect = _lastLightingDeckEffect;+ if (orphaned && typeof orphaned.cleanup === 'function') {+ orphaned.cleanup();+ }+ }updateEffect({visState, mapState, effect});} else if (effect.type === LIGHT_AND_SHADOW_EFFECT.type) {// Keep lighting effects in the array even when disabled to avoid@@ -165,25 +194,50 @@ function disableDeckLightingEffect(deckEffect: any) {}/**- * Update effect to match latest vis and map states+ * Update effect to match latest vis and map states.+ *+ * deck.gl's EffectManager compares effects by `id` and reuses the+ * existing (old) instance when a new one with the same id is supplied+ * (calling `oldEffect.setProps(newEffect.props)` instead of replacing).+ * LightingEffect.setProps only updates light sources, not shadowColor.+ * So we must sync ALL parameters here every frame to ensure the deck+ * effect always reflects the kepler-side state — even if deck.gl+ * silently swapped the instance under us.*/-function updateEffect({visState, mapState, effect}) {+function updateEffect({visState, mapState, effect}: {visState: any; mapState: any; effect: any}) {if (effect.type === LIGHT_AND_SHADOW_EFFECT.type) {- // Re-enable shadow rendering in case it was previously disabledconst deckEffect = effect.deckEffect;+ const {parameters} = effect;++ // Re-enable shadow rendering in case it was previously disabledfor (const light of deckEffect.directionalLights || []) {light.shadow = true;}deckEffect.shadow = deckEffect.directionalLights?.some(l => l.shadow) ?? false;- let {timestamp} = effect.parameters;- const {timeMode} = effect.parameters;- const sunLight = effect.deckEffect.directionalLights[0];+ // Sync shadow color & intensity (not handled by deck.gl setProps)+ deckEffect.shadowColor = [+ ...normalizeColor(parameters.shadowColor),+ parameters.shadowIntensity+ ];++ // Sync ambient light+ if (deckEffect.ambientLight) {+ deckEffect.ambientLight.intensity = parameters.ambientLightIntensity;+ deckEffect.ambientLight.color = parameters.ambientLightColor.slice();+ }++ let {timestamp} = parameters;+ const {timeMode} = parameters;+ const sunLight = deckEffect.directionalLights?.[0];+ if (sunLight) {+ sunLight.color = parameters.sunLightColor.slice();+ }// set timestamp for shadowif (timeMode === LIGHT_AND_SHADOW_EFFECT_TIME_MODES.current) {timestamp = Date.now();- sunLight.timestamp = timestamp;+ if (sunLight) sunLight.timestamp = timestamp;} else if (timeMode === LIGHT_AND_SHADOW_EFFECT_TIME_MODES.animation) {timestamp = visState.animationConfig.currentTime ?? 0;if (!timestamp) {@@ -196,16 +250,16 @@ function updateEffect({visState, mapState, effect}) {timestamp = filter.value?.[0] ?? 0;}}- sunLight.timestamp = timestamp;+ if (sunLight) sunLight.timestamp = timestamp;}// output uniform shadow during nighttimeif (isDaytime(mapState.latitude, mapState.longitude, timestamp)) {- effect.deckEffect.outputUniformShadow = false;- sunLight.intensity = effect.parameters.sunLightIntensity;+ deckEffect.outputUniformShadow = false;+ if (sunLight) sunLight.intensity = parameters.sunLightIntensity;} else {- effect.deckEffect.outputUniformShadow = true;- sunLight.intensity = 0;+ deckEffect.outputUniformShadow = true;+ if (sunLight) sunLight.intensity = 0;}}}diff --git a/src/utils/src/index.ts b/src/utils/src/index.tsindex 3d2f2ec4c..6a297bc08 100644--- a/src/utils/src/index.ts+++ b/src/utils/src/index.ts@@ -112,7 +112,6 @@ export {reorderEffectOrder,validateEffectParameters} from './effect-utils';-// Mapboxexport {isStyleUsingMapboxTiles,