Returns the LatLng for the given offset from the map top-left.
(ptXY)
| 74 | |
| 75 | /** Returns the LatLng for the given offset from the map top-left. */ |
| 76 | fromContainerPixelToLatLng(ptXY) { |
| 77 | if (this.mapCanvasProjection_) { |
| 78 | const latLng = this.mapCanvasProjection_.fromContainerPixelToLatLng(ptXY); |
| 79 | return { lat: latLng.lat(), lng: latLng.lng() }; |
| 80 | } |
| 81 | |
| 82 | const ptxy = { ...ptXY }; |
| 83 | ptxy.x -= this.transform_.width / 2; |
| 84 | ptxy.y -= this.transform_.height / 2; |
| 85 | const ptRes = this.transform_.pointLocation(Point.convert(ptxy)); |
| 86 | |
| 87 | ptRes.lng -= 360 * Math.round(ptRes.lng / 360); // convert 2 google format |
| 88 | return ptRes; |
| 89 | } |
| 90 | |
| 91 | getWidth() { |
| 92 | return this.transform_.width; |
no test coverage detected