Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

feat: add tooltip toggle (#3371)

bdjulbicb42ea3a4ca81
diff --git a/src/components/src/side-panel/layer-panel/layer-configurator.tsx b/src/components/src/side-panel/layer-panel/layer-configurator.tsx
index 9a24b5d0a..23416bc0b 100644
--- a/src/components/src/side-panel/layer-panel/layer-configurator.tsx
+++ b/src/components/src/side-panel/layer-panel/layer-configurator.tsx
@@ -871,6 +871,16 @@ export default function LayerConfiguratorFactory(
</ConfigGroupCollapsibleContent>
</LayerConfigGroup>
) : null}
+
+ {/* Interaction */}
+ {'allowHover' in layer.visConfigSettings ? (
+ <LayerConfigGroup label={'layer.interaction'} collapsible>
+ <VisConfigSwitch
+ {...layer.visConfigSettings.allowHover}
+ {...visConfiguratorProps}
+ />
+ </LayerConfigGroup>
+ ) : null}
</StyledLayerVisualConfigurator>
);
}
diff --git a/src/layers/src/geojson-layer/geojson-layer.ts b/src/layers/src/geojson-layer/geojson-layer.ts
index 9b9e06af3..be2a8f2d5 100644
--- a/src/layers/src/geojson-layer/geojson-layer.ts
+++ b/src/layers/src/geojson-layer/geojson-layer.ts
@@ -82,6 +82,7 @@ export const geojsonVisConfigs: {
enable3d: 'enable3d';
wireframe: 'wireframe';
fixedHeight: 'fixedHeight';
+ allowHover: 'allowHover';
} = {
opacity: 'opacity',
strokeOpacity: {
@@ -105,7 +106,8 @@ export const geojsonVisConfigs: {
filled: 'filled',
enable3d: 'enable3d',
wireframe: 'wireframe',
- fixedHeight: 'fixedHeight'
+ fixedHeight: 'fixedHeight',
+ allowHover: 'allowHover'
};
export type GeoJsonVisConfigSettings = {
@@ -126,6 +128,7 @@ export type GeoJsonVisConfigSettings = {
filled: VisConfigBoolean;
enable3d: VisConfigBoolean;
wireframe: VisConfigBoolean;
+ allowHover: VisConfigBoolean;
};
export type GeoJsonLayerColumnsConfig = {
@@ -150,6 +153,7 @@ export type GeoJsonLayerVisConfig = {
enable3d: boolean;
wireframe: boolean;
fixedHeight: boolean;
+ allowHover: boolean;
};
type GeoJsonLayerVisualChannelConfig = LayerColorConfig &
@@ -699,7 +703,7 @@ export default class GeoJsonLayer extends Layer {
opacity: visConfig.strokeOpacity
};
- const pickable = interactionConfig.tooltip.enabled;
+ const pickable = interactionConfig.tooltip.enabled && visConfig.allowHover;
const hoveredObject = this.hasHoveredObject(objectHovered);
const {data, ...props} = dataProps;
diff --git a/src/localization/src/translations/ca.ts b/src/localization/src/translations/ca.ts
index af04fb1f9..621fdf3e8 100644
--- a/src/localization/src/translations/ca.ts
+++ b/src/localization/src/translations/ca.ts
@@ -152,7 +152,8 @@ export default {
heightRange: 'Rang alçada',
heightMultiplier: "Multiplicador d'alçada",
fixedHeight: 'Alçada fixa',
- fixedHeightDescription: "Utilitzeu l'alçada sense modificacions"
+ fixedHeightDescription: "Utilitzeu l'alçada sense modificacions",
+ allowHover: "Mostra informació d'eina"
},
layerManager: {
addData: 'Afegeix Dades',
diff --git a/src/localization/src/translations/cn.ts b/src/localization/src/translations/cn.ts
index 6fc4a392d..d55b13adf 100644
--- a/src/localization/src/translations/cn.ts
+++ b/src/localization/src/translations/cn.ts
@@ -141,7 +141,8 @@ export default {
showWireframe: '显示线框',
weightIntensity: '加权强度',
zoomScale: '缩放比例',
- heightRange: '高度范围'
+ heightRange: '高度范围',
+ allowHover: '显示工具提示'
},
layerManager: {
addData: '添加数据',
diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.ts
index 2132d684d..049539254 100644
--- a/src/localization/src/translations/en.ts
+++ b/src/localization/src/translations/en.ts
@@ -174,7 +174,7 @@ export default {
heightMultiplier: 'Height Multiplier',
fixedHeight: 'Fixed height',
fixedHeightDescription: 'Use height without modifications',
- allowHover: 'Allow Hover',
+ allowHover: 'Allow hover',
showNeighborOnHover: 'Highlight Neighbors On Hover',
showHighlightColor: 'Show highlight Color',
darkModeEnabled: 'Dark base map',
diff --git a/src/localization/src/translations/es.ts b/src/localization/src/translations/es.ts
index ddee710f9..a2c96525b 100644
--- a/src/localization/src/translations/es.ts
+++ b/src/localization/src/translations/es.ts
@@ -153,7 +153,8 @@ export default {
heightRange: 'Rango de alturas',
heightMultiplier: 'Multiplicador de altura',
fixedHeight: 'Altura fija',
- fixedHeightDescription: 'Usar altura sin modificaciones'
+ fixedHeightDescription: 'Usar altura sin modificaciones',
+ allowHover: 'Mostrar descripción emergente'
},
layerManager: {
addData: 'Añadir datos',
diff --git a/src/localization/src/translations/fi.ts b/src/localization/src/translations/fi.ts
index ca9234d43..94b52fe13 100644
--- a/src/localization/src/translations/fi.ts
+++ b/src/localization/src/translations/fi.ts
@@ -150,7 +150,8 @@ export default {
heightRange: 'Korkeuden rajat',
heightMultiplier: 'Korkeuskerroin',
fixedHeight: 'Kiinteä korkeus',
- fixedHeightDescription: 'Käytä korkeutta ilman muutoksia'
+ fixedHeightDescription: 'Käytä korkeutta ilman muutoksia',
+ allowHover: 'Näytä työkaluvihje'
},
layerManager: {
addData: 'Lisää aineisto',
diff --git a/src/localization/src/translations/ja.ts b/src/localization/src/translations/ja.ts
index 4414dba06..5f385df52 100644
--- a/src/localization/src/translations/ja.ts
+++ b/src/localization/src/translations/ja.ts
@@ -149,7 +149,8 @@ export default {
heightRange: '高さの範囲',
heightMultiplier: '高さ乗数',
fixedHeight: '固定高さ',
- fixedHeightDescription: '高さを変更せずに使用する'
+ fixedHeightDescription: '高さを変更せずに使用する',
+ allowHover: 'ツールチップを表示'
},
layerManager: {
addData: 'データ追加',
diff --git a/src/localization/src/translations/pt.ts b/src/localization/src/translations/pt.ts
index 9e5daabb6..8534c41fc 100644
--- a/src/localization/src/translations/pt.ts
+++ b/src/localization/src/translations/pt.ts
@@ -151,7 +151,8 @@ export default {
heightRange: 'Alcance da Altura',
heightMultiplier: 'Multiplicador de altura',
fixedHeight: 'Altura fixa',
- fixedHeightDescription: 'Use a altura sem modificações'
+ fixedHeightDescription: 'Use a altura sem modificações',
+ allowHover: 'Mostrar dica de ferramenta'
},
layerManager: {
addData: 'Adicionar Dados',
diff --git a/src/localization/src/translations/ru.ts b/src/localization/src/translations/ru.ts
index a8b4a8a98..19cef46db 100644
--- a/src/localization/src/translations/ru.ts
+++ b/src/localization/src/translations/ru.ts
@@ -145,7 +145,8 @@ export default {
weightIntensity: 'Вес Интенсивность',
zoomScale: 'Масштаб увеличения',
heightRange: 'Диапазон высоты',
- heightMultiplier: 'Множитель высоты'
+ heightMultiplier: 'Множитель высоты',
+ allowHover: 'Показать подсказку'
},
layerManager: {
addData: 'Добавить данные',
diff --git a/test/fixtures/state-saved-v0.js b/test/fixtures/state-saved-v0.js
index 82d1cf966..aa91c975a 100644
--- a/test/fixtures/state-saved-v0.js
+++ b/test/fixtures/state-saved-v0.js
@@ -403,7 +403,8 @@ export const savedStateV0 = {
filled: true,
extruded: false,
wireframe: false,
- 'hi-precision': false
+ 'hi-precision': false,
+ allowHover: true
}
}
],
@@ -1414,7 +1415,8 @@ mergedLayer4.config = {
filled: true,
enable3d: false,
wireframe: false,
- strokeOpacity: 0.8
+ strokeOpacity: 0.8,
+ allowHover: true
},
animation: {enabled: false}
};
diff --git a/test/fixtures/state-saved-v1-1.js b/test/fixtures/state-saved-v1-1.js
index 3de975207..f1397ff4b 100644
--- a/test/fixtures/state-saved-v1-1.js
+++ b/test/fixtures/state-saved-v1-1.js
@@ -664,7 +664,8 @@ export const savedStateV1 = {
stroked: true,
filled: true,
enable3d: true,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
@@ -713,7 +714,8 @@ export const savedStateV1 = {
stroked: true,
filled: false,
enable3d: false,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
@@ -972,7 +974,8 @@ mergedLayer0.config = {
strokeColor: [181, 18, 65],
strokeOpacity: 0.8,
enable3d: true,
- wireframe: false
+ wireframe: false,
+ allowHover: true
},
animation: {enabled: false}
};
@@ -2766,7 +2769,8 @@ mergedLayer1.config = {
enable3d: false,
wireframe: false,
strokeColor: [221, 178, 124],
- strokeOpacity: 0.8
+ strokeOpacity: 0.8,
+ allowHover: true
},
animation: {enabled: false}
};
diff --git a/test/fixtures/state-saved-v1-6.js b/test/fixtures/state-saved-v1-6.js
index ea4c3e46f..a06b4904f 100644
--- a/test/fixtures/state-saved-v1-6.js
+++ b/test/fixtures/state-saved-v1-6.js
@@ -656,7 +656,8 @@ export const savedStateWIthNonValidFilters = {
stroked: true,
filled: true,
enable3d: true,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
@@ -705,7 +706,8 @@ export const savedStateWIthNonValidFilters = {
stroked: true,
filled: false,
enable3d: false,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
diff --git a/test/fixtures/state-saved-v1-7.js b/test/fixtures/state-saved-v1-7.js
index 26ba7937a..286dab280 100644
--- a/test/fixtures/state-saved-v1-7.js
+++ b/test/fixtures/state-saved-v1-7.js
@@ -656,7 +656,8 @@ export const savedStateV1InteractionCoordinate = {
stroked: true,
filled: true,
enable3d: true,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
@@ -705,7 +706,8 @@ export const savedStateV1InteractionCoordinate = {
stroked: true,
filled: false,
enable3d: false,
- wireframe: false
+ wireframe: false,
+ allowHover: true
}
},
visualChannels: {
diff --git a/test/helpers/mock-state.js b/test/helpers/mock-state.js
index e0255d624..ce23520c6 100644
--- a/test/helpers/mock-state.js
+++ b/test/helpers/mock-state.js
@@ -1020,7 +1020,8 @@ export const expectedSavedLayer2 = {
filled: true,
enable3d: false,
wireframe: false,
- strokeOpacity: 0.8
+ strokeOpacity: 0.8,
+ allowHover: true
},
textLabel: [DEFAULT_TEXT_LABEL]
},
@@ -1068,7 +1069,8 @@ export const expectedLoadedLayer2 = {
stroked: true,
filled: true,
enable3d: false,
- wireframe: false
+ wireframe: false,
+ allowHover: true
},
colorField: null,
colorScale: 'quantile',