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

优化identify代码 #153

Closed
fuzhenn opened this issue Jun 26, 2023 · 1 comment
Closed

优化identify代码 #153

fuzhenn opened this issue Jun 26, 2023 · 1 comment
Labels

Comments

@fuzhenn
Copy link
Member

fuzhenn commented Jun 26, 2023

现有的代码

function getPickedCoordinate(coordinate) {
      const identifyData = groupLayer.identify(coordinate)[0];
      const pickedPoint = identifyData && identifyData.point;
      if (pickedPoint) {
        const altitude = map_talk.pointAtResToAltitude(pickedPoint[2], map_talk.getGLRes());
        const coordinate = map_talk.pointAtResToCoordinate(new maptalks.Point(pickedPoint[0], pickedPoint[1]), map_talk.getGLRes());
        return new maptalks.Coordinate(coordinate.x, coordinate.y, altitude);
      }else {
          coordinate['z']=0;
          return coordinate;
        }
    }

改为以下的形式

const identifyData = groupLayer.identify(coordinate)[0];
return identifyData && identifyData.coordinate;
@fuzhenn fuzhenn added the bug label Jun 28, 2023
@yy923683900
Copy link
Contributor

fix by 7639458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants