Skip to content

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

[Bug] Fix points disappear while panning across 180th meridian (#450)

Shan Hee5bd5a4df43c
diff --git a/src/components/map-container.js b/src/components/map-container.js
index 76c509380..5abba3ab1 100644
--- a/src/components/map-container.js
+++ b/src/components/map-container.js
@@ -306,7 +306,8 @@ export default function MapContainerFactory(MapPopover, MapControl) {
const data = layerData[idx];
const layerInteraction = {
- mousePosition
+ mousePosition,
+ wrapLongitude: true
};
const objectHovered = clicked || hoverInfo;
diff --git a/src/layers/grid-layer/grid-layer.js b/src/layers/grid-layer/grid-layer.js
index 90719526b..36ae49c52 100644
--- a/src/layers/grid-layer/grid-layer.js
+++ b/src/layers/grid-layer/grid-layer.js
@@ -85,7 +85,8 @@ export default class GridLayer extends AggregationLayer {
objectHovered,
mapState,
interaction,
- layerCallbacks
+ layerCallbacks,
+ layerInteraction
}) {
const zoomFactor = this.getZoomFactor(mapState);
const eleZoomFactor = this.getElevationZoomFactor(mapState);
@@ -95,6 +96,7 @@ export default class GridLayer extends AggregationLayer {
return [
new EnhancedGridLayer({
...data,
+ ...layerInteraction,
id: this.id,
idx,
cellSize,
@@ -130,6 +132,7 @@ export default class GridLayer extends AggregationLayer {
...(this.isLayerHovered(objectHovered) && !visConfig.enable3d
? [
new GeoJsonLayer({
+ ...layerInteraction,
id: `${this.id}-hovered`,
data: [
pointToPolygonGeo({
diff --git a/src/layers/hexagon-layer/hexagon-layer.js b/src/layers/hexagon-layer/hexagon-layer.js
index a4fb2b403..d35282b72 100644
--- a/src/layers/hexagon-layer/hexagon-layer.js
+++ b/src/layers/hexagon-layer/hexagon-layer.js
@@ -67,7 +67,8 @@ export default class HexagonLayer extends AggregationLayer {
objectHovered,
mapState,
interaction,
- layerCallbacks
+ layerCallbacks,
+ layerInteraction
}) {
const zoomFactor = this.getZoomFactor(mapState);
const eleZoomFactor = this.getElevationZoomFactor(mapState);
@@ -77,6 +78,7 @@ export default class HexagonLayer extends AggregationLayer {
return [
new EnhancedHexagonLayer({
...data,
+ ...layerInteraction,
id: this.id,
idx,
@@ -114,6 +116,7 @@ export default class HexagonLayer extends AggregationLayer {
...(this.isLayerHovered(objectHovered) && !visConfig.enable3d
? [
new GeoJsonLayer({
+ ...layerInteraction,
id: `${this.id}-hovered`,
data: [
hexagonToPolygonGeo(
diff --git a/src/layers/icon-layer/icon-layer.js b/src/layers/icon-layer/icon-layer.js
index bf29052e8..1bc1fe80e 100644
--- a/src/layers/icon-layer/icon-layer.js
+++ b/src/layers/icon-layer/icon-layer.js
@@ -238,7 +238,8 @@ export default class IconLayer extends Layer {
idx,
objectHovered,
mapState,
- interactionConfig
+ interactionConfig,
+ layerInteraction
}) {
const layerProps = {
radiusMinPixels: 1,
@@ -251,6 +252,7 @@ export default class IconLayer extends Layer {
new SvgIconLayer({
...layerProps,
...data,
+ ...layerInteraction,
id: this.id,
idx,
opacity: this.config.visConfig.opacity,
diff --git a/src/layers/point-layer/point-layer.js b/src/layers/point-layer/point-layer.js
index 4a810cf53..2006affd6 100644
--- a/src/layers/point-layer/point-layer.js
+++ b/src/layers/point-layer/point-layer.js
@@ -297,6 +297,7 @@ export default class PointLayer extends Layer {
...(this.config.textLabel.field
? [
new TextLayer({
+ ...layerInteraction,
id: `${this.id}-label`,
data: data.data,
getPosition: data.getPosition,