Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: identify 定位不准确 #65

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Conversation

Ray93
Copy link
Contributor

@Ray93 Ray93 commented Feb 27, 2024

        // if no clusters is hit, identify markers
        if (this._markersToDraw && this._markersToDraw[0]) {
            const point = map.coordinateToContainerPoint(coordinate);
            let minDistance = point.distanceTo(map.coordinateToContainerPoint(this._markersToDraw[0]._coordinates));
            let hitPoint = this._markersToDraw[0];
            for (let i = 1; i < this._markersToDraw.length; i++) {
                const dis = point.distanceTo(map.coordinateToContainerPoint(this._markersToDraw[i]._coordinates));
                if (minDistance > dis) {
                    minDistance = dis;
                    hitPoint = this._markersToDraw[i];
                }
            }
            return hitPoint;
        }

当前版本identify方法的判断逻辑有问题,无论点击地图的任何区域,都会返回与点击位置距离最小的maker。
fix #59 #33

@fuzhenn fuzhenn merged commit c2ebb29 into maptalks:master Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

点击 cluster 聚合图形 ,返回返回聚合中集合不准确问题(即 identify 方法不准确 问题)
2 participants