Skip to content

Commit

Permalink
fix: spider handling
Browse files Browse the repository at this point in the history
  • Loading branch information
turban committed Jan 6, 2020
1 parent dcfa4ad commit 1813157
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ export class Map extends Evented {
}

openPopup(content, lnglat, onClose, offset) {
// console.log('openPopup', content, lnglat);

this._popup = new mapboxgl.Popup({
offset: offset,
maxWidth: 'auto',
Expand All @@ -278,8 +276,6 @@ export class Map extends Evented {
}

closePopup() {
// console.log('closePopup');

if (this._popup) {
this._popup.remove()
this._popup = null
Expand Down
8 changes: 4 additions & 4 deletions src/layers/Cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ class Cluster extends Layer {
this.spider.spiderfy(clusterId, lnglat, features)

this.setClusterOpacity(clusterId, true)

this.getMapGL().on('zoom', this.unspiderfy)
}
}

unspiderfy = () => {
if (this.spider) {
this.spider.unspiderfy()
this.spider = null
this.getMapGL().off('zoom', this.unspiderfy)
}
}

Expand Down Expand Up @@ -140,13 +142,11 @@ class Cluster extends Layer {
})

this.setOpacity(this.options.opacity)

mapgl.on('zoom', this.unspiderfy)
}

onRemove() {
this.unspiderfy()
this.getMapGL().off('zoom', this.unspiderfy)
this.spider = null
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/layers/DonutCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DonutCluster extends Cluster {
const { groups, opacity } = this.options
const mapgl = this.getMapGL()
const newClusters = {}
const features = mapgl.querySourceFeatures(this.getId())
const features = this.getSourceFeatures()

// For every cluster on the screen, create an donut marker
for (let i = 0; i < features.length; i++) {
Expand Down Expand Up @@ -124,7 +124,6 @@ class DonutCluster extends Cluster {
evt.feature = { type, id, properties, geometry }
}

// console.log('EVENT CLICK FIRED', evt);
this.fire('click', evt)
} else {
this.zoomToCluster(
Expand Down

0 comments on commit 1813157

Please sign in to comment.