google-map-react/google-map-react

Fullscreen mouse coordinates

Open

#741 ouverte le 8 avr. 2019

Voir sur GitHub
 (1 commentaire) (6 réactions) (0 assignés)JavaScript (888 forks)batch import
help wanted

Métriques du dépôt

Stars
 (6 224 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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>

Guide contributeur