Skip to content

Commit

Permalink
on map seamlessZoom: true sometimes clusterCache[z] returns undefined (
Browse files Browse the repository at this point in the history
…#45)

Co-authored-by: Fu Zhen <[email protected]>
  • Loading branch information
Fomoire and fuzhenn authored Jul 19, 2022
1 parent 3b2f6b8 commit 801c37c
Show file tree
Hide file tree
Showing 5 changed files with 1,703 additions and 451 deletions.
2 changes: 1 addition & 1 deletion dist/maptalks.markercluster.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ ClusterLayer.registerRenderer('canvas', function (_maptalks$renderer$Ve) {
var pgx = Math.floor((center.x - min.x) / r),
pgy = Math.floor((center.y - min.y) / r);
var pkey = pgx + '_' + pgy;
var parent = _this5._clusterCache[z]['clusterMap'][pkey];
var parent = _this5._clusterCache[z] ? _this5._clusterCache[z]['clusterMap'][pkey] : null;
if (parent) {
var pp = map._prjToContainerPoint(parent['center']);
pt = pp.add(pt.sub(pp)._multi(ratio));
Expand Down
2 changes: 1 addition & 1 deletion dist/maptalks.markercluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ ClusterLayer.registerRenderer('canvas', function (_maptalks$renderer$Ve) {
var pgx = Math.floor((center.x - min.x) / r),
pgy = Math.floor((center.y - min.y) / r);
var pkey = pgx + '_' + pgy;
var parent = _this5._clusterCache[z]['clusterMap'][pkey];
var parent = _this5._clusterCache[z] ? _this5._clusterCache[z]['clusterMap'][pkey] : null;
if (parent) {
var pp = map._prjToContainerPoint(parent['center']);
pt = pp.add(pt.sub(pp)._multi(ratio));
Expand Down
2 changes: 1 addition & 1 deletion dist/maptalks.markercluster.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ ClusterLayer.registerRenderer('canvas', class extends maptalks.renderer.VectorLa
const pgx = Math.floor((center.x - min.x) / r),
pgy = Math.floor((center.y - min.y) / r);
const pkey = pgx + '_' + pgy;
const parent = this._clusterCache[z]['clusterMap'][pkey];
const parent = this._clusterCache[z] ? this._clusterCache[z]['clusterMap'][pkey]: null;
if (parent) {
const pp = map._prjToContainerPoint(parent['center']);
pt = pp.add(pt.sub(pp)._multi(ratio));
Expand Down
Loading

0 comments on commit 801c37c

Please sign in to comment.