google-map-react/google-map-react

Fullscreen mouse coordinates

Open

#741 建立於 2019年4月8日

在 GitHub 查看
 (1 留言) (6 反應) (0 負責人)JavaScript (6,224 star) (888 fork)batch import
help wanted

描述

When entering fullscreen mode the hover prop is not triggered when hovering since the coordinates for the mouse are reported wrongly, the coordinates below are what is reported to the distance to mouse prop. When not in fullscreen mode and hovering the mouse close to the marker. The map is 322x500 and the marker is centered.

mousePos: {
  "x": 158.578125,
  "y": 248.84375,
  "lat": 59.33579226338481,
  "lng": 18.060302737204665,
}
pt: {
  {
  "x": 161.0390625,
  "y": 250,
  "lat": 59.33576695645176,
  "lng": 18.060408349184666,
}

When in fullscreen the coordinates are as followed. Still with the marker centered.

mousePos: {
  "x": 784.078125,
  "y": -44.15625,
  "lat": 59.349862733968806,
  "lng": 18.052858601359958,
}
pt: {
  "x": 960,
  "y": 600,
  "lat": 59.33576695645176,
  "lng": 18.060408349184666,
}

my map component is as follows

<GoogleMapReact
      bootstrapURLKeys={{
        key: process.env.GOOGLE_MAPS_API_KEY,
        language: 'sv',
        region: 'se',
      }}
      center={props.center}
      zoom={props.zoom}
      hoverDistance={50}
      onChildClick={props.onChildClick}
      options={createMapOptions}
      distanceToMouse={customDistanceToMouse}
    >
      {props.children}
    </GoogleMapReact>

貢獻者指南